简体   繁体   English

电子邮件似乎仅发送给gmail

[英]Emails only seem to being sent to gmail

I'm using some code to send data to a database which also sends a confirmation email to the email address that was entered into the form field 我正在使用一些代码将数据发送到数据库,该数据库还会将确认电子邮件发送到在表单字段中输入的电子邮件地址

For some strange reason, it only seems to send to my gmail account and nothing else like hotmail tiscali yahoo 由于某些奇怪的原因,它似乎只发送到我的Gmail帐户,而没有其他邮件,例如hotmail tiscali yahoo

Here's the code I'm using to send the email 这是我用来发送电子邮件的代码

 // this send the receiver an email with the link to their ecard
 mail("$receiveremail","Somebody loves you !", "<img src=\"http://www.somebodylovesyou.co.uk/images/email-header.jpg\" width=\"300\" height=\"57\"> 
 </p>
 <p>Hello $name,</p>
 <p>Someone you know has sent you a secret valentine's message from http://www.somebodylovesyou.co.uk </p>
 <p>You can view your message here : <a href='http://www.somebodylovesyou.co.uk/viewcard.php?rand=$eid'>http://www.somebodylovesyou.co.uk/viewcard.php?rand=$eid</a></P>
 <P>Why not send a special someone a secret valentine's message at http://www.somebodylovesyou.co.uk</p>
 <P>Happy Valentines", $headers); 

 // this send the receiver an email with the link to their ecard
 mail("$youremail","View the message you've just sent", "<img src=\"http://www.somebodylovesyou.co.uk/images/email-header.jpg\" width=\"300\" height=\"57\"> 
 </p>
 <p>Hello,</p>
 <p>Thanks for using Somebody Loves You </p>
 <p>You can view the message you sent here : <a href='http://www.somebodylovesyou.co.uk/viewcard.php?rand=$eid'>http://www.somebodylovesyou.co.uk/viewcard.php?rand=$eid</a></P>
 <P>Happy Valentine's", $headers);?>

I was advised to use these headers as well to help sending the emails but it doesnt seem to work 有人建议我也使用这些标头来帮助发送电子邮件,但似乎不起作用

 // these headers are for the purpose of sending the email replay to hotmail and yahoo addresses
 $headers = "MIME-Version: 1.0\r\n"; 
 $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
 $headers .= "From: SOMEBODY LOVES YOU <hello@somebodylovesyou.co.uk>\r\n"; 
 $headers .= "Reply-To: <hello@somebodylovesyou.co.uk>\r\n"; 
 $headers .= "X-Priority: 3\r\n"; 
 $headers .= "X-MSMail-Priority: Normal\r\n"; 
 $headers .= "X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409\r\n"; 
 $headers .= "X-Mailer: Microsoft Outlook Express 6.00.2800.1409";

Technically Gmail is exactly the same as any other e-mail service when it comes to the protocol, so I guess it's not a code-related problem. 从技术上讲,Gmail与该协议的任何其他电子邮件服务完全相同,因此我认为这不是与代码相关的问题。

What I'd check is your outgoing e-mail server and domain, especially two things: 我要检查的是您的传出电子邮件服务器和域,尤其是两件事:

These are e-mail forgery prevention techniques. 这些是防止电子邮件伪造的技术。 Some e-mail services will automatically reject any mails without SPFs and DKIM. 某些电子邮件服务将自动拒绝没有SPF和DKIM的任何邮件。

Try SwiftMailer It's very easy to utilize and it is very robust 试试SwiftMailer,它非常易于使用并且非常强大

$body = "<img src=\"http://www.somebodylovesyou.co.uk/images/email-header.jpg\" width=\"300\" height=\"57\">   </p>  <p>Hello $name,</p>  <p>Someone you know has sent you a secret valentine's message from http://www.somebodylovesyou.co.uk </p>  <p>You can view your message here : <a href='http://www.somebodylovesyou.co.uk/viewcard.php?rand=$eid'>http://www.somebodylovesyou.co.uk/viewcard.php?rand=$eid</a></P> <P>Why not send a special someone a secret valentine's message at http://www.somebodylovesyou.co.uk</p>  <P>Happy Valentines</p>";      
    $transport = Swift_MailTransport::newInstance();

     $mailer = Swift_Mailer::newInstance($transport);
     $message = Swift_Message::newInstance($subject)
             ->setFrom(array("hello@somebodylovesyou.co.uk" => "SOMEBODY LOVES YOU"))
             ->setTo(array($receiveremail))
             ->setBody($body, 'text/html');

$mailer->send($message);

It sounds like this is not an issue with your code. 听起来这与您的代码无关。 If it's arriving to one mail provider but not another then the other providers are blocking it or marking it as spam. 如果邮件到达的是一个邮件提供商,而不是另一个邮件提供商,则其他提供商将其阻止或将其标记为垃圾邮件。

At this point what you want to look into ensuring MX records and other DNS records are correctly set to identify your server. 此时,您要检查确保正确设置MX记录和其他DNS记录以标识您的服务器。

It's also possible that your domain / IP has been blacklisted. 您的域/ IP也可能已被列入黑名单。 In that event each mail provider has steps you can take to get off their blacklist. 在这种情况下,每个邮件提供商都可以采取一些步骤来摆脱其黑名单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM