[英]Phpmailer returns blank page without sending email
I develop a PHP system that need to send an email to the user. 我开发了一个PHP系统,该系统需要向用户发送电子邮件。 I need to use Outlook account to send the email and I'm using PHPmailer.
我需要使用Outlook帐户发送电子邮件,而我正在使用PHPmailer。
FYI, my SMTP is valid because I get it from my company IT department. 仅供参考,我的SMTP有效,因为我是从公司IT部门获得的。
This is what I changed in both php.ini(Apache & PHP) : [mail function] ; 这就是我在php.ini(Apache&PHP)中都更改的内容:[mail function]; For Win32 only.
仅适用于Win32。 ;
; http://php.net/smtp SMTP = abc-smtp.mycompany.local ;
http://php.net/smtp SMTP = abc-smtp.mycompany.local; http://php.net/smtp-port smtp_port = 25
http://php.net/smtp-port smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = abc@mycompany.com
It failed when I try to send the email. 当我尝试发送电子邮件时失败。 There is no output showing error include telling the message has been sent or message was not sent.
没有输出显示错误,包括告诉消息已发送或消息未发送。
I tried to do some changes include : 1) change the port to 465, but it gives error saying :- 我尝试做一些更改,包括:1)将端口更改为465,但给出错误消息:-
fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: SSL: crypto
enabling timeout in C:\wamp\www\assetmanagementsystem\class.smtp.php on line 122
2) Uncomment extension=php_openssl.dll. 2)取消注释扩展名= php_openssl.dll。 3) Grant my IP address in the SMTP server.
3)在SMTP服务器中授予我的IP地址。
Does anybody know what should I do to allow the outlook send my email ? 有人知道我应该怎么做才能允许Outlook发送我的电子邮件吗? Please help me.
请帮我。 I really dont know what to do now.
我真的不知道该怎么办。 This is my coding for sending the mail .
这是我发送邮件的代码。
require_once('class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "";
$mail->Host = 'abc-smtp.mycompany.local';
$mail->Port = 25;
$mail->Username = "";
$mail->Password = "";
$mail->From = "abc@mycompany.com";
$mail->FromName = "Asset Management System";
$mail->Subject = "Notification on less of stock";
$mail->MsgHTML($message);
$mail->AddAddress("abc@mycompany.com","Asset Management System");
$mail->IsHTML(true);
if(!$mail->Send())
echo "Message was not sent <br />PHPMailer Error: " . $mail->ErrorInfo;
else
echo "Message has been sent";
Here is my answer: 这是我的答案:
$mail = new PHPMailer();
$mail->SMTPdebug = true;
$mail->IsSMTP();
$mail->Host = '10.xxx.xxx.xxx';
$mail->CharSet = 'UTF-8';
$mail->IsHTML(false);
$mail->AddReplyTo($email, "Vertragsverwaltung");
$mail->SetFrom('vertragsverwaltung@domain.de', 'Vertragsverwaltung');
$address = $email;
$mail->AddAddress($address, "John Doe");
$mail->Subject = "This is my subject";
$mail->Body = "Text: \n\r" . $message;
if (!$mail->Send()) {
echo "[" . date("d.m.Y H:i", time()) . "] Mailer Error: " . $mail->ErrorInfo;
} else {
echo "[" . date("d.m.Y H:i", time()) . "] Message sent!";
}
Not enough text, blablablablablablablablasdjkflasjdflöasdjflaösdjfalösdjf 没有足够的文字,blablablablablablablablasdjkflasjdflöasdjflaösdjfalösdjf
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.