Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // 1. include PHPMailerAutoload.php
- require 'phpmailer/PHPMailerAutoload.php';
- // 2. create an instance of PHPMailer
- $mail = new PHPMailer();
- // 3. set a host
- $mail->Host = "smtp.gmail.com";
- // 4. enable SMTP
- // $mail->isSMTP();
- // 5. set authentication to true
- $mail->SMTPAuth = true;
- // 6. set login details for gmail account
- $mail->Username = "md.mahbub7931@gmail.com";
- $mail->Password = "mahbub01814724579";
- // 7. set type of protection
- $mail->SMTPSecure = "ssl"; // or we can use TLS
- // 8. set a port
- $mail->Port = 465; // or 587 if TLS or 80 if TLS and SSL not have.
- // 9. set subject
- $mail->Subject = "test email";
- // set html to true
- $mail->isHTML(true);
- // 10.set body
- $mail->Body = "this is our body..";
- // 11.set who is sending an email
- $mail->setFrom('redhatmahbub@gmail.com','redhatmahbub');
- // 12.set where we are sending email (recipients)
- $mail->addAddress('md.mahbub7931@gmail.com');
- // 13.send an email
- if($mail->send()){
- echo "mail is sent";
- }
- else
- {
- echo "something wrong happen";
- }
- ?>
Add Comment
Please, Sign In to add comment