Results 1 to 6 of 6

Thread: Pear Mail SMPT Timeout

  1. #1
    Join Date
    Jan 2005

    Pear Mail SMPT Timeout

    Hey all,
    Ok so I got my pear mail script to run but im geting SMTP time out issue
    How can i deagnose the problem? Is there a way to do test block ex determine if SMTP found, connected to smtp, authenticated, sent message... and not jsust test for mail sent?

    Hope some one can help me out?

    PHP Code:

    // Constructing the email
    $sender "xxxx<xxxx@mailserver.net>";                                  // Your name and email address
    $recipient "<xxxxx@hotmail.com>";                               // The Recipients name and email address
    $subject "Our New System";                                                // Subject for the email
            //$text = 'This is a text message.';                                      // Text version of the email
    $html '<html><body><p>Hey please veryfy that our new system is working!</p></body></html>';      // HTML version of the email
    $crlf "\n";
    $headers = array(
    'From'          => $sender,
    'Return-Path'   => $sender,
    'Subject'       => $subject 
    // Creating the Mime message
    $mime = new Mail_mime($crlf);
    // Setting the body of the email
    // Set body and headers ready for base mail class 
    $body $mime->get();
    $headers $mime->headers($headers);
    // SMTP authentication params
    $smtp_params["host"] = "mailserver.net";         // SMTP host
    $smtp_params["port"] = "587";               // SMTP Port (usually 25)     
    $smtp_params["auth"]     = true;
    $smtp_params["username"] = "xxxxx";
    $smtp_params["password"] = "xxxxx";
    // Sending the email using smtp
    $mail =& Mail::factory("smtp"$smtp_params); 
    $result $mail->send($recipient$headers$body);
    $result === 1)
    "Your message has been sent!");
    "Your message was not sent: " $result);

    So far here is my reply from server:

    Your message was not sent: Failed to connect to mail101.net:587 [SMTP: Failed to connect socket: Connection timed out (code: -1, response: )]

  2. #2
    Join Date
    Jul 2009
    Falls Church, Va.
    Your server is failing to connect at all to mail101.net on port 587 - it's not reachable, and it timed out on your side while waiting for any response. If there was a handshake things would be different.

    Things to check, in order:

    • Most mail hosts allow IMCP so can you ping the hostname or only by IP? Check for DNS issue - you'd be surprised how common this is.
    • Are you sure its not smtp.mail101.net or whatever subhost name? Sometimes they use mail101.net CNAMED for web traffic (port 80), not mail, sometimes not. Use whatever "official" FQDN they require, if unsure.
    • Make sure your local firewall/proxy allows port 587 traffic.
    • Check to see if mail101.net restricts access based on IP - give them your server WAN IP if so - might be firewall issue on their side or white hat access list.
    • Note - 587 can be used for SMTP but usually that's 25 (for the simple reason most firewall setups permit it and shut down 587) - this ties into my other advice, so this is an FYI, try port 25 if all else fails just to see (assuming you have no docs or help from mail101.net as to client setup)

    Last edited by SrWebDeveloper; 03-12-2010 at 09:39 AM.

  3. #3
    Join Date
    Jan 2005
    ok i think hosting provder is blocking me
    is there any way to probe what ports they ha opened? (from inside)

    i clled 3 times and got 3 differen answers about opened ports and none of them worked...

  4. #4
    Join Date
    Jan 2005
    here is another question, how can i sent email to multiple users ?
    I tried to use comma separated rescipients but that gave me an error.
    Also I think that wouuld revieal the user list to other users ((

    I have 200 email list that i need to send few updates.... im going crazu... probably should pay that mailing service and releve me from headach but i like to DIY

  5. #5
    Join Date
    Jul 2009
    Falls Church, Va.
    If you think the host is blocking you, give them your server IP and ask what port you should be using (confirm 587 vs. 25). It's up to you to ensure you can reach them, I already gave advice as to that (ping/local firewall). If you talked to 3 people, talk to another just ask for manager this time and complain you've been given conflicting info. My general advice still holds true.

    As to multiple emails, assuming same subject and body, use commas to separate valid email addresses for to/bcc/cc as you need. PHP's mail function expects commas. Obviously post error message, relevant code and a few example emails (change domain name to foobar but keep rest intact so we can see syntax) if this doesn't work as expected, plus plenty of freeware PHP scripts to process email for ya including smtp, multiple addresses, templates for listserv and so on.

    Here's one that's excellent


  6. #6
    Join Date
    Jan 2005
    ok tnx.. i will call suport and keep annoying them =)

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
HTML5 Development Center

Recent Articles