我正在使用swiftmailer发送确认电子邮件,它在大多数域中都可以正常工作。由于某些原因,yahoo.com和icloud.com从未收到电子邮件。他们不在垃圾邮件/垃圾箱中-好像他们已将我的域列入黑名单,但这是该域第一次向其域发送电子邮件,因此我认为这不太可能。
$transport = (new \Swift_SmtpTransport('mail.smtpserver.org', 465, 'ssl'))
->setUserName('user@smtpserver.org')
->setPassword($email_password);
//Create a Swiftmailer instance
$swift= (new \Swift_Mailer($transport));
//Create content
$content = "This is only a test. If this were an actual email, you would receive it. But you won't, because your email address is in the yahoo or icloud domain. Tough luck.";
$fromEmail = "user@smtpserver.org";
$fromName = "Same name as in email account on smtpserver.org";
$message = (new \Swift_Message("$fname, Whassup!"))
->setFrom(["$fromEmail" => "$fromName"])
->setTo(["$email" => "$fname, $lname"])
->setBody($content,'text/html')
->addPart(strip_tags($content), 'text/plain');
$swift->send($message);