SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Unable to send mail in PHP.

    I was sending mails to my customers using php . Everything was fine till last week all of a sudden the mail script is not working and this is the error message I am receiving

    "Warning: mail() [function.mail]: SMTP server response: 553 sorry, that domain isn't allowed to be relayed thru this MTA (#5.7.1)"

    Assuming this has to be some authentication issue as I was using from as my gmail account.

    So I tried a new script


    <?php
    require_once "Mail.php";

    $from = "Sandra Sender <XXXX@gmail.com>";
    $to = "Ramona Recipient <XXXXX@yahoo.com>";
    $subject = "Hi!";
    $body = "Hi,\n\nHow are you?";

    $host = "smtp.gmail.com";
    $username = "XXXX@gmail.com";
    $password = "XXXXXX";

    $headers = array ('From' => $from,
    'To' => $to,
    'Subject' => $subject);
    $smtp = Mail::factory('smtp',
    array ('host' => $host,
    '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>");
    }
    ?>


    I am receiving a following error for this new authenticating script

    Failed opening required 'Mail.php' (include_path='.\;C:\Program Files\HSphere\3rdparty\PHP\PHP4\PEAR')

    Seeing the error i am assuming the pear mail script is not installed in my server. How should I install the script. I am in shared hosting so can i do this or my hosting company will do this.

    In a great trouble because of this as this is business critical.Please help me sort out this.

  2. #2
    SitePoint Addict
    Join Date
    Jul 2008
    Location
    sudo rm -rf /
    Posts
    386
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Addict
    Join Date
    Apr 2009
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mail is a built in PHP function. You shouldn't need to include a script to get it to function.


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
  •