Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2006
    Posts
    56

    Unanswered: PHP mail() - doesn't support auth ?!

    Hi!!!

    I'm getting this error while attempting to send an email from my localhost, as a test.

    Warning: mail() [function.mail]: SMTP server response: 554 <name@server.com>: Relay access denied in C:\WebServer\Apache\htdocs\_php\lost_password.php on line 135
    It's an Apache server, latest PHP, on Windows XP.

    I have configured PHP.ini SMTP to my actual SMTP server, and am using a valid email address from that server. I believe it's not relaying because of the lack of authentication.

    I have searched the web for an authentication method in this mail function, but all I could find was some people's posts in other forums saying that PHP mail() does not support authentication.

    I refused to believe that, and so here I am. Is that for real? I mean... it's just plain stupid! I need to be able to relay from remote servers! If PHP mail() doesn't support that, how may I accomplish this?

    Thanks for any help.

  2. #2
    Join Date
    Apr 2006
    Location
    Denver, Co. USA
    Posts
    242
    The php mail() function acts like an unauthenticated email client. It does not support SMTP authentication.

    To do what you want, you will need to open a socket to the SMTP server and exchange SMTP commands directly. The phpmailer class http://sourceforge.net/projects/phpmailer/ and the swiftmailer class http://sourceforge.net/projects/swiftmailer/ both support SMTP authentication and will save you from needing to write your own code.

  3. #3
    Join Date
    Jul 2006
    Posts
    56
    Thanks, man!

    I also found these classes, from Manuel Lemos:

    http://www.phpclasses.org/mimemessage
    http://www.phpclasses.org/smtpclass
    http://www.phpclasses.org/sasl

    Are those any good?

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by igordonin
    Thanks, man!

    I also found these classes, from Manuel Lemos:

    http://www.phpclasses.org/mimemessage
    http://www.phpclasses.org/smtpclass
    http://www.phpclasses.org/sasl

    Are those any good?
    ive used the sendmail class from phpclasses for 7+ years without any problems. It did take a little bit of work to integrate it into my codebase but worked fine. PHPclasses is a useful resource.. well worth looking at. even if you can't find something that exactly meets your requirements then you can often find somethign to base your own class, and it should go without saying when you do develop or extend a class consider listing that class on the website

Posting Permissions

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