【发布时间】:2014-07-01 11:13:05
【问题描述】:
我正在使用此扩展程序。 http://www.yiiframework.com/extension/smtp-mail
我会正常工作。但未设置我在 "SetFrom()" 函数中定义的邮件中的电子邮件 ID,但它需要 Gmail 用户名 (myemail@gmail.com)。
以下是我在控制器中发送邮件的代码。
$mail = Yii::app()->Smtpmail;
$mail->SetFrom("otherid",$from_name); // This id not coming in my response mail
$mail->Subject = $subject;
$mail->MsgHTML($message);
$mail->AddAddress($to, "");
config/main.php
'Smtpmail'=>array(
'class' => 'application.extensions.smtpmail.PHPMailer',
'Host' => "smtp.gmail.com",
'Username' => 'myemail@gmail.com',
'Password' => 'password',
'Mailer' => 'smtp',
'Port' => 465,
'SMTPAuth' => true,
'SMTPSecure' => 'ssl'
),
【问题讨论】:
-
您为
$mail对象设置的确切值是多少?"otherid"实际上是一些电子邮件 ID 对吗? -
$mail 对象首先加载我的扩展类。然后分配 to, from , from name 和 msg.