Config Mail Server Yii User

hello i, newer in Yii i attach YIIuser modules in my web sites try to config my mail server but they show below error.

PHP warning

mail() [<a href=‘function.mail’>function.mail</a>]: Failed to connect to mailserver at &quot;localhost&quot; port 25, verify your &quot;SMTP&quot; and &quot;smtp_port&quot; setting in php.ini or use ini_set()

E:\wamp\www\newuser\protected\modules\user\UserModule.php(210)

198 }

199 return self::$_admins;

200 }

201

202 /**

203 * Send mail method

204 */

205 public static function sendMail($email,$subject,$message) {

206 $adminEmail = Yii::app()->params[‘adminEmail’];

207 $headers = "MIME-Version: 1.0\r\nFrom: $adminEmail\r\nReply-To: $adminEmail\r\nContent-Type: text/html; charset=utf-8";

208 $message = wordwrap($message, 70);

209 $message = str_replace("\n.", "\n…", $message);

210 return mail($email,’=?UTF-8?B?’.base64_encode($subject).’?=’,$message,$headers);

211 }

212

213 /**

214 * Return safe user data.

215 * @param user id not required

216 * @return user object or false

217 */

218 public static function user($id=0) {

219 if ($id)

220 return User::model()->active()->findbyPk($id);

221 else {

222 if(Yii::app()->user->isGuest) {

.how i solve this

instruction please

Hi,

First you can downloaded this extension

=>http://www.yiiframework.com/extension/phpmailer/

and put the extension in protected/extensions folder

Otherwise you can create the common function

public static function actionMailSend($to,$firstname,$subject,$message)

{


	&#036;mail = new JPhpMailer;


	&#036;mail-&gt;IsSMTP();





	&#036;mail-&gt;Host = 'your_host_name;


	&#036;mail-&gt;SMTPAuth = true;





	&#036;mail-&gt;Username = 'your_user_name';


	&#036;mail-&gt;Port = 'your_port';


	&#036;mail-&gt;Password = 'your_password';





	&#036;mail-&gt;SetFrom('your_email_id', 'your_name');


	&#036;mail-&gt;Subject = &#036;subject;


	&#036;mail-&gt;MsgHTML(&#036;message);


	&#036;mail-&gt;AddAddress(&#036;to, &#036;firstname);


	if(&#036;mail-&gt;Send())


	{


		return true;


	}


	else{


		return false;


	}





}

put this function in common file and then after you can call

$result = $this->actionMailSend($emailId,$firstname,$subject,$message);

Note:put your smtp,username,password and port in server configuration detail not in local

Best Regards,

Ankit Modi

[color="#006400"]/* moved from Job Opportunities */[/color]