Announcement

Collapse
No announcement yet.

How to send email via PHPMailer - Linux server

Collapse

Ads on showthread pages

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to send email via PHPMailer - Linux server

    WordPress Hosting on SSD Servers
    Hello All,

    In order to send email from Linux server from PHPMailer then one can use below mentioned sample script:


    <?php

    require("class.phpmailer.php");

    $mail = new PHPMailer();

    $mail->IsSMTP(); // send via SMTP
    $mail->Host = "mail.yourdomainname"; // SMTP servers
    $mail->SMTPAuth = true; // turn on SMTP authentication
    $mail->Username = "SMTP Email Username"; // SMTP username
    $mail->Password = "SMTP Email password"; // SMTP password

    $mail->From = "From Email address";
    $mail->FromName = "Name to Display";
    $mail->AddAddress("Recipient Email address ","Recipient Name");
    $mail->AddCC("CC Email Address");
    $mail->AddBCC("BCC Email address");
    $mail->AddReplyTo("Reply to email address");

    $mail->WordWrap = 50; // set word wrap

    $mail->IsHTML(true); // send as HTML

    $mail->Subject = "Subject";
    $mail->Body = "body";

    if(!$mail->Send())
    {
    echo "Message did not sent <p>";
    echo "Mailer Error: " . $mail->ErrorInfo;
    exit;
    }

    echo "Message has been sent";

    ?>

    Thanks,

    Shane G.
    AccuWebHosting.Com
    Last edited by admin; 08-04-2015, 08:09 AM.

  • #2
    ASP.Net Hosting starts @ $3.18/Mo.
    Re: How to send email via PHPMailer - Linux server

    Hello Shane,

    Hey, that was really a great script.. I was searching for a long while. Thank you very much man.. But one thing, when I add the CC and BCC fields, it gives me the error. Hence I need to remove those fields. can you help it out?????
    Last edited by admin; 08-04-2015, 08:13 AM.

    Comment

    Working...
    X
    Sign up for a News Letter Click here to sign up