i can’t sending email using YiiMailer. nothing error but the email not send. please help me.
config/main.php
‘mail’ => array(
'class' => 'ext.yii-mail.YiiMail',
'transportType'=>'smtp',
'transportOptions'=>array(
'host'=>'smtp.gmail.com',
'username'=>'xxxxxxxxxxxxxxxxx',
'password'=>'xxxxxxxxxxxxxxxxx',
'port'=>'25',
),
'viewPath' => 'application.views.mail',
),
controler
<?php
Class EmailController extends Controller {
Yii::import(‘ext.yii-mail.YiiMailMessage’);
public function actionKirim() {
$this -> layout = ‘null’;
if (isset($_POST[‘Data’])) {
//amdil data dari form
$data = $_POST[‘Data’];
//set email to
$emailTo = $data[‘email’];
//set subject
$subject = ‘Anda Mendapatkan Disposisi Surat’;
//set message
$message = ‘Anda mendapatkan disposisi surat. Silahkan cek E-OFFICE Anda’;
//panggil php mailer
$mail = Yii::app() -> Smtpmail;
//add replay to (penerima membalas akan ditujukan ke email ini)
$mail -> AddReplyTo(‘stefanhendysulis@gmail.com’, ‘’);
//add bcc
$mail -> AddBcc(‘stefanhendysulis@gmail.com’);
//menyatakan email dikirim dari siapa
$mail -> SetFrom(‘stefanhendysulis@gmail.com’, ‘Notifikasi E-OFFICE’);
//set subject
$mail -> Subject = $subject;
//set message untuk dikirim
$mail -> MsgHTML($message);
//set email address to dikirim
$mail -> AddAddress($emailTo, "");
//jika email tidak dikirim maka tampilkan error
if (!$mail -> Send()) {
echo "Mailer Error: " . $mail -> ErrorInfo;
} else {
//else tampilkan sukses
echo "Message sent!";
}
}
//render form untuk kirim email
$this -> render(‘index2’);
}
}
//located at protected\controllers
?>
view
<tr>
<td class="a">Email Penerima</td>
<td class="a1">:</td>
<td class="b"><input size ="64" name = "data[email]"/></td>
</tr>
<tr><td>
<div class=“button”><a class=“button” onclick=“fp(\‘content\’,\‘f3\’,\’’.Yii::app()->createUrl(‘smdata/index2’).’\’,\‘tmb4=Simpan\’);”>Simpan</a></div>
</td></tr>