简体   繁体   English

phpmailer返回空白页而不发送电子邮件

[英]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.

相关问题 PHPMailer发送电子邮件并返回带有echo的空白页面 - PHPMailer sending email and returning blank page with echo PHPMailer发送到空白页 - PHPMailer sending to blank page PHPMailer无法通过Gmail发送电子邮件,返回空白页 - PHPMailer not sending e-mail through Gmail, returns blank page PHPMailer不从HTML表单发送,返回空白页面 - PHPMailer not sending from HTML form, returns blank page 使用phpmailer发送电子邮件会返回大量数据 - sending email using phpmailer returns a chunk of data 从同一页面的phpmailer发送多个电子邮件 - Sending multiple email from same page phpmailer 在发送带有PHPMailer的电子邮件后,在同一页面上显示成功/失败消息,而无需重新加载或重定向页面 - After sending email with PHPMailer show success/failure message on the same page without reloading or redirecting the page HTML / PHP:如何使用PHPMailer通过电子邮件发送表单而不出现空白页? - HTML/PHP: How do I email a form using PHPMailer without getting a blank page? 发送邮件验证后,laravel 返回空白注册页面,而不是 email-verify 路由 - After sending email verification, laravel returns to blank register page instead of email-verify route 使用 phpmailer 向打印机发送附件会导致第一页空白 - Sending printer an attachment with phpmailer causes blank first page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM