Skip to main content
gamedev.net
🔒 Locked

HTTP Mail

Started by Empirical Feb 22, 2005 at 5:36 PM 7 replies 650+ views
Original Post
Empirical
Empirical
Can anyone post a link to any articals on logging on and sending an email via a http mail server (e.g hotmail) using winsock? Unfortunatly searching for http and mail in any combination i can think of matches any URL starting mail! Ta!
Evil Steve
Evil Steve
Sending mail with HTTP is just a case of submitting a form. The exact form information you use for sending mail depends on the site that you use (e.g. Hotmail).
If you want to use Hotmail, you'll have a lot of fun using HTTPS to log in correctly.

Why do you want to do this? Using SMTP and routing the mail through your ISP is going to be a lot simpler.
Empirical
Empirical
Quote:
Original post by Evil Steve
Sending mail with HTTP is just a case of submitting a form. The exact form information you use for sending mail depends on the site that you use (e.g. Hotmail).
If you want to use Hotmail, you'll have a lot of fun using HTTPS to log in correctly.

Why do you want to do this? Using SMTP and routing the mail through your ISP is going to be a lot simpler.


If someone gets the username and password out the exe, it wont matter. Distributing passwords to strangers (even if encrypted) seems a bit dodgy!

Just thinking it over for a registration function for my setup program, in the far far future.

I guess if no one comes up with articals and I cant find any which detail the exact methords, I might go with the SMTP, but hotmail is so much more 'throwaway' if yu know what i mean?
Evil Steve
Evil Steve
You can't send E-mail from Hotmail without logging in. There may be anonymous HTTP mail sites, but I very much doubt it.
Or do you want to send mail to Hotmail? If so, then it's no different from sending mail to any other address. You can either send the mail through the user's ISPs mail server (the easy way, but you need to ask the user for their mail server address [e.g. smtp.blueyonder.co.uk]), or the hard way - Find the MX record for the site (by doing a DNS lookup), so you can get the IP address of the mail server, and then send mail to it.

If you use a non-HTTP based mail server (e.g. your ISPs E-mail), you can usually just connect on port 25, but the "correct" way to do it is still with an MX lookup.

Assuming your ISP's mail server is smtp.blueyonder.co.uk, and your E-mail is blah@blueyonder.co.uk, you'd do this in the client program (which can be run from anywhere):
  • Use winsock to connect to smtp.blueyonder.co.uk on port 25
  • Send the following:
    "HELO My mail sending program\r\n"
    "MAIL FROM:\r\n"
    "RCPT TO:\r\n"
    "DATA\r\n"
    "This user has registered.\r\n"
    ".\r\n"
    "QUIT\r\n"

    That's assuming that there's no error responses. You should really send one line at a time and wait for the response, but this way should be ok.
  • Empirical
    Empirical
    Quote:
    Original post by Evil Steve
    You can't send E-mail from Hotmail without logging in. There may be anonymous HTTP mail sites, but I very much doubt it.
    Or do you want to send mail to Hotmail?


    No, sorry I'm not being clear.

    I dont intend to use anonymous, but what i mean is id rather risk a hotmail account being compromised than my own ISP account.

    If someone did (unlikley I know) screw with the hotmail account, i could create a new one in five minuets.

    I am on blueyonder, but wont i have to sigh in first before i can send a message as in the above example?
    igni ferroque
    igni ferroque
    ISPs might have port 25 blocked, in which case you couldn't send mail directly from your program without relaying it through the user's mail server.

    The cleanest options for handling program registration are:
    • Open up a new mail window in their default mail client (no idea how to do this in Windows) OR
    • Set up a script on your web site to receive registration requests. All your program needs to do then is send the information via HTTP POST.


    As for the Hotmail option, I would be that such use would be a violation of their terms of service.
    Free Mac Mini (I know, I'm a tool)
    Evil Steve
    Evil Steve
    Hmm... Logging in to anything from a users machine for registration purposes is just asking for trouble. Perhaps there's another way to do what you want?
    Remember that to send mail with SMTP you don't need to log in. In fact, you don't even need a valid e-mail address (although some [very few] SMTP servers validate the return address).
    igni ferroque
    igni ferroque
    Quote:
    Original post by Evil SteveRemember that to send mail with SMTP you don't need to log in. In fact, you don't even need a valid e-mail address (although some [very few] SMTP servers validate the return address).
    But some may use SMTP with authentication or any number of variations of SMTP that would be difficult to code for.

    The best and easiest option is to set up your own registration webservice over HTTP and have the software connect to that.
    Free Mac Mini (I know, I'm a tool)
    Empirical
    Empirical
    Thanks for the advice. I considered having a php script to take details a last resort (unless anyone knows ree hosting with php allowed!)

    I know how to send a message via the users own mail client, but its not very professional is it? Also, some of my software is used by management of a train operating company. Trust me, the less they have to be involved, the less likley they are to screw it up!!

    Ta anyway. I'll have to play with SMTP to see if i can send without auth.

    Topic Locked

    This topic has been locked by a moderator. New replies are not allowed.

    Sign in to reply to this topic.