Jump to content

SMTP authentication?


B0b

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.