Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("C:\\xampp\\phpMailer\\PHPMailer-master\\class.phpmailer.php");
- $mail = new PHPMailer();
- $mail->IsSMTP(); // telling the class to use SMTP
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->SMTPSecure = 'ssl' ;
- $mail->Host = "smtp.gmail.com" ;// SMTP server
- $mail->Port = 465; // or 587 <br/>
- $mail->Username = 'senderemailid@gmail.com'; // SMTP username
- $mail->Password = 'senderpassword'; // SMTP password
- $mail -> IsHTML(true);
- $mail->From = 'senderemailid@gmail.com';
- $mail->FromName = 'sendername';
- $mail->addAddress('receiveremailid@domain.com','receivername');
- $mail->WordWrap = 50;
- $mail->Subject = "This mail send from PhP code xampp";
- $mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
- if(!$mail->Send()) {
- echo 'Message was not sent.';
- echo 'Mailer error: ' . $mail->ErrorInfo;
- } else
- {
- echo 'Message has been sent.';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement