dongyouji7022 2012-05-25 23:41
浏览 18

PHP发送邮件功能

I don't understand why my send mail function has stopped working. It used to work ok, but I've just discovered that users who try to sign up to my website no longer receive an email.

I must have changed something by accident.

I've stripped out all of the details to try and get back to basics and work out the problem. But the below code - with correct email addresses replaced - still doesn't work. It always prints that it has succeeded, but emails do not get sent to the address.

Grateful for your help!

$email_address2 = "my@email.com";
    $header2 = "From: webmaster@domain.org.uk
";

    $subject2 = "Your Membership!";
    $message2 = "
    The message2
    ";

$mailsend = mail($email_address2, $subject2, $message2, $header2.">
X-Mailer: PHP/" . phpversion());

if($mailsend) {
    echo 'Your membership information has been mailed to your email address!<br/><br/>Please check it and follow the directions!';
} else {
print "There has been an error. Please try again";
}
  • 写回答

1条回答 默认 最新

  • douna4762 2012-07-17 10:56
    关注

    The first step would be to figure out where sendmail is installed. Once you know that path, go into your php.ini. You are looking for the sendmail_path setting. Set it appropriately.

    If the path is set correctly, the result from a proper call to mail() should return true. (Note that the return value only lets you know if the message was passed on to sendmail [or SMTP in the case of Windows]. It does not guarantee that the e-mail went out, or that sendmail is configured correctly.) If it is returning true and you still aren't getting e-mail, then check your sendmail configuration.

    评论

报告相同问题?

悬赏问题

  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。