无法使用wp_mail()发送邮件

时间:2022-02-05 00:11:02

I am trying to send mail using wp_mail using the following code :

我正在尝试使用以下代码使用wp_mail发送邮件:

$headers[] = 'From: Singhal Competition Classes <example@singhalcompetitionclasses.com>';
        $headers[] = 'Content-Type: text/html; charset=UTF-8';
        $messg = "Hi $user_id .... <br/><br/>Thank You for taking the online exam. Your Score card is as follow : <br/><br/><table><tr><td>
        Total Correct Answer :</td><td> $correct_ansq </td></tr>
        <tr><td>Not Given Answer  </td><td> $no_ans </td></tr>
        <tr><td> Total Wrong Answer </td><td> $wrong <br/></td></tr>
        <tr><td> Percentage </td><td> $result % </td></tr>
        <tr><td>Result </td><td> $result</td></tr></table>
        ";
        $to_mail = $useremail;
        $subject = "Online Exam Score Card";
        wp_mail( $to_mail, $subject, $messg, $headers );

I have true the wp debug but when Complete the action I got no error

我确实是wp调试但是当完成动作时我没有错误

neither I recieve any mail in my inbox or spam

我收到的收件箱或垃圾邮件都没有收到任何邮件

What may be the following error

可能是以下错误

1 个解决方案

#1


0  

Here is a good example on how: http://www.tutorialspoint.com/php/php_sending_emails.htm

以下是一个很好的例子:http://www.tutorialspoint.com/php/php_sending_emails.htm

Open the php.ini, fill in the SMTP and Sendmail section, with your server name, password and e-mail address.

打开php.ini,使用您的服务器名称,密码和电子邮件地址填写SMTP和Sendmail部分。

From website.

[mail function]
; For Win32 only.
SMTP = smtp.secureserver.net

; For win32 only
sendmail_from = webmaster@tutorialspoint.com

#1


0  

Here is a good example on how: http://www.tutorialspoint.com/php/php_sending_emails.htm

以下是一个很好的例子:http://www.tutorialspoint.com/php/php_sending_emails.htm

Open the php.ini, fill in the SMTP and Sendmail section, with your server name, password and e-mail address.

打开php.ini,使用您的服务器名称,密码和电子邮件地址填写SMTP和Sendmail部分。

From website.

[mail function]
; For Win32 only.
SMTP = smtp.secureserver.net

; For win32 only
sendmail_from = webmaster@tutorialspoint.com