public function mailsend($name, $contact_no, $email,$website,$content,$subject,$address )
{
$message = new YiiMailMessage;
$message->view = 'viewfilenm';
$message->setBody(array(), 'text/html');
$body = $message->message->getBody();
/****** preg_replace :Perform a regular expression search and replace ******/
$body = preg_replace('/\[FNAME]/',$name,$body);
$body = preg_replace('/\[CONTENT]/',$content,$body);
$find = array("[CONTACT_NO]"=>$contact_no,"[FNAME]"=>$name,"[EMAIL]"=>$email,"[ADDRESS]"=>$address);
/****** strtr :Translate characters or replace substrings ******/
$newstr = strtr($content, $find);
$body = str_replace($content,$newstr,$body);
$body = preg_replace('/\[CONTACT_NO]/',$contact_no,$body);
$body = preg_replace('/\[EMAIL]/',$email,$body);
$body = preg_replace('/\[SUBJECT]/',$subject,$body);
$body = preg_replace('/\[WEBSITE]/',$website,$body);
$message->message->setBody($body, 'text/html');
$message->subject = $subject;
$message->addTo($email);
$message->from = ('abc@abc.com');
Yii::app()->mail->send($message);
}
如果我通过我的$message->addTo()
gmail id 然后在 gmail 中我收到了邮件。但是如果我通过我的雅虎或其他身份,$message->addTo()
那么我不会收到邮件,也不会显示错误。