B0b Posted June 15, 2010 Share Posted June 15, 2010 Hello, I am trying to send an email from an Hotmail account, but hotmail doesn't recognise "AUTH LOGIN" command? May you tell me why? Here's how it looks like: getmxrr( 'hotmail.com', $MXs ); $sock = socket_create( AF_INET, SOCK_STREAM, SOL_TCP ); socket_connect( $sock, $MXs[0], 25 ); echo socket_read( $sock, 2082 ); // 220 bay0-mc1-f27.Bay0.hotmail.com... socket_write( $sock, 'EHLO mydomain.com' . "\r\n" ); echo socket_read( $sock, 2082 ); // 250-bay0-mc1-f27.Bay0.hotmail.com (3.11.0.113)... socket_write( $sock, base64_encode( 'AUTH LOGIN' ) . "\r\n" ); echo socket_read( $sock, 2082 ); // This returns 500 Unrecognized command Quote Link to comment Share on other sites More sharing options...
B0b Posted June 15, 2010 Author Share Posted June 15, 2010 Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted June 15, 2010 Share Posted June 15, 2010 Why are you doing <?php socket_write( $sock, base64_encode( 'AUTH LOGIN' ) . "\r\n" ); ?> and not <?php socket_write( $sock, "AUTH LOGIN\r\n" ); ?> Actually, why are you doing this at all? Ken Quote Link to comment Share on other sites More sharing options...
B0b Posted June 16, 2010 Author Share Posted June 16, 2010 Thanks for your input Ken. I don't know why there's a base64_encode there, but my situation has evolved since my last message. My goal is simply to send out an email from an Hotmail account (it. through SMTP authentication). Here's how the code looks like right now: <?php $sock = socket_create( AF_INET, SOCK_STREAM, SOL_TCP ); socket_bind( $sock, 'XX.XX.XX.XX' ); socket_connect( $sock, 'smtp.live.com', 25 ); socket_write( $sock, 'EHLO mydomain' . "\r\n" ); socket_write( $sock, 'STARTTLS' . "\r\n" ); socket_write( $sock, 'EHLO mydomain' . "\r\n" ); socket_write( $sock, 'AUTH LOGIN' . "\r\n" ); socket_write( $sock, 'myemail' . "\r\n" ); socket_write( $sock, 'mypassword' . "\r\n" ); socket_write( $sock, 'MAIL FROM: <anotheremail>' . "\r\n" ); // And this will output this error: "Connection reset by peer". I've been told Hotmail requires an SSL connection and fsockopen would solve this, but I got to bind an IP address to my socket, so here I am. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.