如何从Swift Mail向gmail发送电子邮件

时间:2016-02-15 09:39:17

标签: php email phpmailer swiftmailer

我正在使用Swift Mail库从我的网站发送电子邮件。

代码工作正常并且已成功将电子邮件发送到我的域电子邮件,但大多数情况下它不会向我的gmailHotmail地址发送电子邮件。

假设我从我的网站发送了3封电子邮件,我在domain inbox收到了所有3封电子邮件,但我的gmailhotmail帐户只收到1封电子邮件或有时没有收到电子邮件。< / p>

我正在使用godaddy托管。

请指导我在这里做错了什么。

require_once 'lib/swift_required.php';
date_default_timezone_set('Africa/Lagos');

$name=      $_REQUEST['name'];
$user_message=  $_REQUEST['comment'];
$email=     $_REQUEST['email'];


// Create the mail transport configuration
$transport = Swift_MailTransport::newInstance();

// Create the message
$message = Swift_Message::newInstance();
$message->setTo(array(
  "info@domainName.com" => "DomainName",
  "myGmailId@gmail.com" => "Kirmani"
));
$message->setSubject("Email from Easenook");
$message->setBody("$user_message");
$message->setFrom("$email", "$name");

// Send the email
$mailer = Swift_Mailer::newInstance($transport);
$mailer->send($message);


echo 'sent';

0 个答案:

没有答案
相关问题