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 Link to comment https://forums.phpfreaks.com/topic/204880-smtp-authentication/ Share on other sites More sharing options...
B0b Posted June 15, 2010 Author Share Posted June 15, 2010 Link to comment https://forums.phpfreaks.com/topic/204880-smtp-authentication/#findComment-1072625 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 Link to comment https://forums.phpfreaks.com/topic/204880-smtp-authentication/#findComment-1072707 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. Link to comment https://forums.phpfreaks.com/topic/204880-smtp-authentication/#findComment-1072716 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.