Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to integrate PHP Mailer

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 263
    Comment on it

    Hello Reader's! If you want to send email some other than php mail then php mailer is the best option. PHPMailer provides an object oriented interface, but in case of php mail() is not object oriented. Let's see how to integarte php mailer function.

    You can download PHPMailer from git from here

    Now extract the folder and create a php file with the following code:-

    require_once "vendor/autoload.php";
    //PHPMailer Object
    $mail = new PHPMailer;
    //From email address and name
    $mail->From = "";
    $mail->FromName = "Full Name";
    //To address and name
    $mail->addAddress("", "Recepient Name");
    $mail->addAddress(""); //Recipient name is optional
    //Address to which recipient will reply
    $mail->addReplyTo("", "Reply");
    //CC and BCC
    //Send HTML or Plain Text email
    $mail->Subject = "Subject Text";
    $mail->Body = "<i>Mail body in HTML</i>";
    $mail->AltBody = "This is the plain text version of the email content";
        echo "Mailer Error: " . $mail->ErrorInfo;
        echo "Message has been sent successfully";

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: