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", "asdasd22e@hotmail.com", "asd@yahoo.com", "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"); 
}
?>
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

In your example, you have an email where the sender is "someone@yahoo.com".

 

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?

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.