Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //example.php
- <?php
- require 'phpmailer/PHPMailerAutoload.php';
- $mail = new PHPMailer(); // create a new object
- $mail->IsSMTP(); // enable SMTP
- $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
- $mail->SMTPAuth = true; // authentication enabled
- //$mail->SMTPSecure = 'tls'; // secure transfer enabled REQUIRED for GMail
- $mail->Host = gethostbyname('smtp.gmail.com');
- $mail->Port = 587; // or 587
- $mail->IsHTML(true);
- $mail->Username = "myemail@gmail.com";
- $mail->Password = "gmailpass";
- $mail->SetFrom("myemail@gmail.com");
- $mail->Subject = "Test";
- $mail->Body = "hello";
- $mail->AddAddress("recipient@gmail.com");
- if(!$mail->Send()){
- echo "Mailer Error: " . $mail->ErrorInfo;
- } else {
- echo "Message has been sent";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement