Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'phpmailer/PHPMailerAutoload.php';
- $nama_penerima=$_POST['nama'];
- $email_penerima=$_POST['email'];
- $pesan=$_POST['pesan'];
- $subjek="Contoh email - codingan.com";
- $mail = new PHPMailer(true);
- // memberitahu class untuk menggunakan SMTP
- $mail->IsSMTP();
- // mengaktifkan debug SMTP (untuk pengujian) atur 0 untuk menonaktifkan mode debugging, 1 untuk menampilkan hasil debug
- $mail->SMTPDebug = 0;
- // mengaktifkan otentikasi SMTP
- $mail->SMTPAuth = true;
- // menetapkan prefix ke server
- $mail->SMTPSecure = 'ssl';
- // atur Gmail sebagai server SMTP
- $mail->Host = 'smtp.gmail.com';
- // atur server SMTP untuk server Gmail
- $mail->Port = 465;
- $mail->Username = "dewiwataru18@gmail.com";
- $mail->Password = "dee_yorozuya";
- $webmaster_email = "dewiwataru18@gmail.com";
- $email = $email_penerima;
- $name = $nama_penerima;
- $mail->From= $webmaster_email;
- $mail->FromName="Dewi Septiani";
- $mail->AddAddress($email, $name);
- $mail->AddReplyTo($webmaster_email, "Dewi Septiani");
- $mail->WordWrap = 50;
- $mail->IsHTML(true);
- $mail->Subject = $subjek;
- $mail->Body = $pesan;
- $mail->AltBody = "";
- if(!$mail->Send()) {
- echo "mail error" . $mail->ErrorInfo;
- } else {
- echo "email berhasil di kirim";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement