用于在php中退回电子邮件的代码 [英] Code for Bounce back email in php
问题描述
大家好。
我开发了一个静态网站,其中包含一个PHP的电子邮件脚本。我可以发送和接收电子邮件,但前提是收件人或发件人的电子邮件地址是info@mydomain.com。如果我尝试发件人和收件人地址都是gmail / yahoo,那么脚本无效。
当我联系托管公司时,他们会要求我代码退回电子邮件,以便检测到失败的原因。
现在,我需要在php中反弹电子邮件脚本的代码。
谢谢
代码为:
Hello everyone
I have developed a static website with one email script in PHP. I am able to send and receive emails but only if the recipient or sender email address is info@mydomain.com. If i try both the sender and receiver address to be gmail/ yahoo then the script is not working.
When i contact the hosting company for the same, they ask me to code for bounce back email so that a reason for the failure could be detected.
Now, i need code for that bounce back email script in php.
Thank you
the code is:
<?php
$to= "mymail@gmail.com";
$emailSubject = "Here is an email ";
$emailContext = "Sending content using PHP mail function";
$emailHeaders = "Cc: mymail@yahoo.co.in" . "\r\n";
$from= "-fsomeone@yahoo.co.in";
$emailStatus = mail($to, $emailSubject, $emailContext, $emailHeaders, $from);
if($emailStatus) {
echo "Email Sent!";
} else {
echo "Email not sent";
}
?>
这个代码无效,因为没有像info@mydomain.com这样的地址,如果我用info@mydomain.com替换任何toaddress或fromaddress,那么脚本将无法正常工作
This code is not working because there is no address like info@mydomain.com, if i replace any of the toaddress or fromaddress with info@mydomain.com, then the script will working not otherwise
推荐答案
to = mymail@gmail.com;
to= "mymail@gmail.com";
emailSubject = 这是一封电子邮件;
emailSubject = "Here is an email ";
emailContext = 使用PHP邮件功能发送内容;
emailContext = "Sending content using PHP mail function";
这篇关于用于在php中退回电子邮件的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!