Jump to content

How to send mail via command "HELO" "MAIL FROM"?


alkogolic

Recommended Posts

How to send mail via command "HELO" "MAIL FROM"?

Error "Warning: fsockopen() [function.fsockopen]: unable to connect to hotmail.com:25"

Code:

<?
socketmail("hotmail.com", "[email protected]", "[email protected]", "sub", "mess");

function socketmail($server, $to, $from, $subject, $message) {
    $connect = fsockopen ($server, 25, $errno, $errstr, 30);
    fputs($connect, "HELO localhost\r\n");
    fputs($connect, "MAIL FROM: $from\n");
    fputs($connect, "RCPT TO: $to\n");
    fputs($connect, "DATA\r\n");
    fputs($connect, "Content-Type: text/plain; charset=iso-8859-1\n");
    fputs($connect, "To: $to\n");
    fputs($connect, "Subject: $subject\n");
    fputs($connect, "\n\n");
    fputs($connect, stripslashes($message)." \r\n");
    fputs($connect, ".\r\n");
    fputs($connect, "RSET\r\n"); 
}
?>

Thanks, but i want send email via command HELO.

Why hotmail.com disconnect my?

 

First off... what you are saying you want to do is implement the SMTP protocol.  That is non trivial, and the libraries suggested provide full implementations of those protocols.  With that said, mail transfer agent (MTA) configuration and email verification in the age of spam is a fact of life.  Email systems like hotmail do all sorts of things to verify where email is originating from, not limited to, checking for MX records, reverse dns verification, SPF verification and DKIM.  In your example, trying to spoof a yahoo.com email sender is likely to just be rejected outright as spam because you will fail all sorts of spam checks on their server.  They don't want people doing what you're trying to do, and you're wasting your time trying it.

 

Of course there could also be a simpler explanation of your outright disconnection, in that hotmail.com is now defunct/deprecated and hotmail is now outlook.com.  See:  http://geeks.broadwayworld.com/article/Microsoft-Shutting-Down-Hotmail-After-16-Years-20130503

 

Even if it wasn't shutdown, there is really no reason to reinvent the wheel for smtp, with libraries that do it for you, not to mention, the mail() function.

Yes, i want implement the SMTP protocol.

<?
$connect = fsockopen ("hotmail.com", 25, $errno, $errstr, 30);
?>

Warning: fsockopen(): unable to connect to hotmail.com:25

 

 in that hotmail.com is now defunct/deprecated and hotmail is now outlook.com

 

<?
$connect = fsockopen ("outlook.com", 25, $errno, $errstr, 30);
?>

Warning: fsockopen(): unable to connect to outlook.com:25

Why?

 

php script hosted in domain for example domain.com

DNS records this is domain:

f0c7d4a8.png

neither hotmail.com nor outlook.com are the hosts you should be trying to connect to if you want to send mail to an @hotmail or @outlook address. Not going to say which are the proper addresses, if you want to be spamming people you can figure out how to do it yourself.

In your example, you have an email where the sender is "[email protected]".

 

Almost all systems do the following:

 

- Check the sender domain (yahoo.com)

- Get the mx records for that domain using DNS

- Is this server who is connecting to me, an mx for yahoo.com?

 

In your case, the answer is NO. The email will be either rejected, or accepted and immediately deleted from their queue.

 

Obviously you are not even getting to that point, however, it is likely that you will end up there.

 

Your immediate issue is this, the mx records for hotmail are:

 

5 mx2.hotmail.com

5 mx3.hotmail.com

5 mx1.hotmail.com

5 mx4.hotmail.com

 

Again, if you don't understand SMTP and how email works, why are you trying to write your own SMTP stack?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.