Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'phpmailer/class.phpmailer.php';
- $mail = new PHPMailer;
- $mail->IsSMTP();
- $mail->SMTPAuth = true;
- $mail->Host = "smtp.gmail.com";
- $mail->Port = 587;
- $mail->Username = "myusername@gmail.com";
- $mail->Password = "gmail_password";
- $mail->From = 'donotreply@mydomain.com';
- $mail->FromName = 'Admin';
- $mail->AddAddress('Toreceiver@test.com', 'Receiver'); // Add a recipient
- $mail->IsHTML(true);
- $mail->Subject = 'Here is the Subject';
- $mail->WordWrap = 50;
- $mail->Body = "This is in <b>Blod Text</b>";
- $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
- if(!$mail->Send()) {
- echo 'Message could not be sent.';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- exit;
- }
- echo 'Message has been sent';
- ?>
- $mail->SetFrom('donotreply@mydomain.com', 'Admin');
- $mail->SMTPDebug = 2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement