SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Some question about Pear Mail

  1. #1
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    804
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Some question about Pear Mail

    I get a Pear message of, "Validation failed for: My-Example.com" when $from = "My-Example.com <support@my-example.com>". However, I don't get an error if I change $from to "Example <support@my-example.com>" Why would having a hypen and a .com as part of the FROM address cause validation errors?

    Also, is this the most efficient way to send out 500 emails or more at one time? I don't know tons about SMTP, but I assume it is authenticating with the SMTP server for every single email that is being sent out with my DO WHILE loop.

    Thoughts?

    PHP Code:
    $from "My-Example.com <support@my-example.com>";
    $host "mail.my-example.com";
    $username "support@my-example.com";
    $password "******";

    $headers = array (
    'To' => $recipient,
    'From' => $from,
    'Subject' => $subject,
    'Reply-To' => $sender,
    'Errors-To' => $sender);

    $smtp Mail::factory('smtp', array (
    'host' => $host,
    'auth' => true,
     
    'username' => $username,
    'password' => $password));

    $mail $smtp->send($recipient$headers$body);

    if (
    PEAR::isError($mail)) {
    echo(
    "<p>" $mail->getMessage() . "</p>");
    } else {
    $success "Yes";
    //Code for updating the DB table so the email doesn't get resent.

    Convert your dollars into silver coins. www.convert2silver.com

  2. #2
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    804
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hello? Still looking for some help.
    Convert your dollars into silver coins. www.convert2silver.com

Bookmarks

Posting Permissions

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