Jumat, 04 Oktober 2013

PHP Indonesia - Facebook: [AsK] Php Mailer on Mac OS X permisi kakak2 maste...

PHP Indonesia - Facebook
PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
The Ultimate Sports Fundraising Program

This $27 online course teaches fundraising approaches specifically for sports programs. Learn to raise money like the nation's top programs. Sign up today.
From our sponsors
[AsK] Php Mailer on Mac OS X permisi kakak2 maste...
Oct 4th 2013, 08:07, by Romdoni Agung

Romdoni Agung 8:07am Oct 4
[AsK]
Php Mailer on Mac OS X

permisi kakak2 master,, ane mau numpang nanya tentang php mailer atau mengirim email menggunakan account GMAIL.
yang pertama kali ane lakukan membuat function/class mail, berikut source nya
var $mail;

public function __construct()
{
require_once('PHPMailer/class.phpmailer.php');

// the true param means it will throw exceptions on errors, which we need to catch
$this->mail = new PHPMailer(true);

$this->mail->IsSMTP(); // telling the class to use SMTP

$this->mail->CharSet = "utf-8"; // CharSet
$this->mail->SMTPDebug = 0; // enables SMTP debug information
$this->mail->SMTPAuth = true; // enable SMTP authentication
$this->mail->SMTPSecure = "tls"; // sets the prefix to the servier
$this->mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$this->mail->Port = 587; // set the SMTP port for the GMAIL server
$this->mail->Username = "adadeh@gmail.com";// GMAIL username
$this->mail->Password = "kepokepo"; // GMAIL password
$this->mail->AddReplyTo('adadeh@gmail.com', 'Romdoni Agung Purbayanto');
$this->mail->SetFrom('adadeh@gmail.com', 'donny');
}

public function sendmail($to, $to_name, $subject, $body){
try{
$this->mail->AddAddress($to, $to_name);

$this->mail->Subject = $subject;
$this->mail->Body = $body;

$this->mail->Send();
echo "<script>consloe.log('Message Sent OK'); </script>";

} catch (phpmailerException $e) {
echo "<script>consloe.log(".$e->errorMessage()."); </script>"; //Pretty error messages from PHPMailer

} catch (Exception $e) {
echo "<script>consloe.log(".$e->getMessage()."); </script>"; //Boring error messages from anything else!
}
}

setelah itu ane pergi ke controller dan memakai class mail yang tadi ane buat, berikut potongan script nya,,
$this->mailer->sendmail(
$to,
'doni',
$subjek,
$mail_body
);

trus ane jalanin dan tentu saja gagal (nggk asik kalo langsung sukses :p :p :p )
trus ane pergi/edit php.ini dan menghapus komentar extension=php_openssl.dll
lalu ane restart server(apache)
dan ane jalankan (gagal lagi)

ada yang bisa bantu tidak kakak2 master sekalian
thanks sebelumnya

best regards

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

Tidak ada komentar:

Posting Komentar