Help with PHPMailer and BCC
Results 1 to 4 of 4

Thread: Help with PHPMailer and BCC

  1. #1
    Senior Member ali_p's Avatar
    Join Date
    Oct 2003

    Help with PHPMailer and BCC


    I'm using PHPMailer to send mailout to about 1500 email addresses coming from a database, but i would like to send using BCC , as going through a loop and sending a mail for each address times out.

    However i'm a bit stuck on how to get all the email addresses in the BCC i keep getting this error:
    Message was not sentMailer Error: Language string failed to load: recipients_failed
    when i use the following code

    PHP Code:

    SELECT *
    FROM amails
    $result mysql_query($sql$conn)or die(mysql_error());
        while (
    $row mysql_fetch_array($result)) {
    //give a name to the fields

    $mail = new PHPMailer();
    $mail->IsSMTP(); // telling the class to use SMTP
    $mail->Host ""// SMTP server
    $mail->From "";
    $mail->FromName "";
    $mail->Subject "Online";

    $mail->Body 'Embedded Image: <img src="cid:my" alt="cover" >'
    $mail->Body "
    <table width=\"500\" border=\"1\" align=\"center\" cellpadding=\"3\" cellspacing=\"4\" bordercolor=\"#CCCCCC\" bgcolor=\"#FFFFFF\">
    <tr><td><a href=\"
    $email_id\">Click here</a> to remove your address from this mailing list</td></tr>
    $mail->WordWrap 50;

    "Message was not sent";
    "Mailer Error: " $mail->ErrorInfo;
    $display_block" meassage sent to $email\n";

    I'm not quite sure how i get all the addresses in to the BCC. Help would be greatly appreciated.

  2. #2
    Member ncracraf's Avatar
    Join Date
    Oct 2005
    Campbell, CA
    I'm doing some research on a different phpmailer / BCC issue but since I had the same issue as this post, thought I'd reply with what I did to fix it.

    The phpmailer package has three essential files:

    class.smtp.php (optional - only needed for SMTP)
    language file: phpmailer.lang-en.php (English althought there are a bunch of others)

    In the phpmailer instructions ( you're supposed to add these files to the php.ini includes path. Instead I just referenced as includes at the top of my scripts.

    PHP Code:
    'lib/phpmailer/language/phpmailer.lang-en.php') ; 
    I was getting the same error (Language string failed to load) until I added the second include for the phpmailer.lang-en.php language file. Once I did that, the mailer worked fine with no error messages.

  3. #3
    Junior Member
    Join Date
    Mar 2007

    Possible Solution

    I was running into the same problems and looked into all sorts of fixes.
    I was pulling the from address from a database and that from address was not an address on the server. Therefore there was a security issue that was not allowing the phpmailer function to work, and giving the error message in question.

    What I found if the following:

    The From address should be the email address you are using for the smtp authentication.
    You can use
    this->AddReplyTo("$fromaddress", "$fromaname");
    to set the reply to address to whatever address you like, particularly the person sending the email.

    The complete function looked like this:

    $mail = new PHPMailer();

    $mail->Host = "somehostcom";
    $mail->SMTPAuth = true; // turn on SMTP authentication
    $mail->Username = ""; // SMTP username
    $mail->Password = "somepassword"; // SMTP password

    $mail->From = "";
    $mail->FromName = "$fromname";
    $mail->AddReplyTo("$fromaddress", "$fromname");

    of course in this scenario, the $mail would be replaced by $this.

  4. #4
    Junior Member
    Join Date
    Jun 2009
    Hi ali_p

    Did you fix this problem ?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts