Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2009
    Posts
    68
    Thanks
    22
    Thanked 0 Times in 0 Posts

    PHP to SMTP email script

    Hi

    I am using the script below to send an email to my main pop3 email, and cc to my yahoo mail.

    The message never makes it to yahoo, any idea why?

    Kind Regards
    Nick Burrett

    PHP Code:
    <?php

    require_once "Mail.php";

    $from "Nick Burrett <xxx>";
    $to "Nick Burrett <xxx>";
    $subject "Test message from Gmail";
    $cc "Nick Burrett <xxx>";
    $body "Test message from Gmail";

    $host "ssl://smtp.gmail.com";
    $port "465";
    $username "xxx";
    $password "xxx";

    $headers = array ('From' => $from'To' => $to'Subject' => $subject'CC' => $cc);
    $smtp Mail::factory('smtp', array ('host' => $host'port' => $port'auth' => true'username' => $username'password' => $password));

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

    if (
    PEAR::isError($mail)) {
    echo(
    "<p>" $mail->getMessage() . "</p>");
    } else {
    echo(
    "<p>Message successfully sent!</p>");
    }

    ?>

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    it seems to me that I had this issue before, try removing the name and brackets

    $cc = "Nick Burrett <xxx>";

    and just use the email address and see if that works. I think that I had this issue and found that I couildn't get the name/email combo working but just the email.


  •  

    Tags for this Thread

    Posting Permissions

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