вообще то использую это расширение
www.yiiframework.com/extension/smtp-mail/#hh0
но думаю суть у них общая
config
'components' => array(
'Smtpmail'=>array(
'class'=>'application.extensions.smtpmail.PHPMailer',
'Host'=>"myfactory.mail.ru",
'Username'=>'',
'Password'=>'',
'Mailer'=>'smtp',
'Port'=>25,
'SMTPAuth'=>false,
'SMTPDebug' => 1,
),
контролер
public static function mailsend($to,$from,$subject,$message){
$mail=Yii::app()->Smtpmail;
$mail->SetFrom($from, 'From NAme');
$mail->Subject = $subject;
$mail->MsgHTML($message);
$mail->AddAddress($to, "");
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
}else {
echo "Message sent!";
}
$mail->ClearAddresses();
}
public function actionContact()
{
\\\\\
SiteController::mailsend(Yii::app()->params['adminEmail'],$model->name,'test',$model->body);
Invalid address: adminSMTP -> ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: ����������� ��� �����, �� ������ ������������ ���� �� �������. (0)
The following From address failed: root@localhost : Called Mail() without being connected Mailer Error: The following From address failed: root@localhost : Called Mail() without being connected
обязательно ли указывать логин\пас?