php - 检测是否发送电子邮件 [英] php - detect if email is sent

查看:131
本文介绍了php - 检测是否发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立一个自动化的通讯,我有一个困扰这个问题。
我需要知道邮件是否被发送。这是我的代码

  @ $ send = mail($ emailRecipient,$ subject,$ message,$ headers); 

我试图将它添加到一个if语句,但这里不起作用的是代码。如果(@ $ send = mail($ emailRecipient,$ subject,$ message,$ headers)){
//

做某事
} else {
// do something
}


解决方案

  if(@mail($ emailRecipient,$ subject,$ message,$ headers))
{
echoMail发送成功;
} else {
echoMail Not Sent;
}


Im building an automated newsletter, im kinda stuck with this problem. I need to know if the email was sent or not. Here is my code

 @$send = mail($emailRecipient, $subject, $message, $headers);

i tried to add it to an if statement but it does not work here is the code.

if( @$send = mail($emailRecipient, $subject, $message, $headers)){
   //do something
}else{
  //do something
}

解决方案

if(@mail($emailRecipient, $subject, $message, $headers))
{
  echo "Mail Sent Successfully";
}else{
  echo "Mail Not Sent";
}

这篇关于php - 检测是否发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆