Sending emails.

Started by
5 comments, last by Thevenin 18 years, 9 months ago
I need my CGI application (Programmed in C) to send emails to the players. I'm familiar with winsock, and hoping I can just isolate the domain of the email address, connect to it, and send a single TCP packet without having to parse though protocal headers and such. Problem is, I don't know what to include in that TCP packet, or wheter a single TCP packet will do. Anyone mind explaining to me what I need to do, or a link to a tutorial?
Advertisement
You'll need to use SMTP, it's pretty simple.

Send something like this:

HELO smtp.wanadoo.co.uk
MAIL FROM:omgwtf@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com
RCPT TO:bbq@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com
DATA
blah blah this isn't s.p.a.m by the way :)
PS Viagra click here ;P
.

The server will send you responses. If they start with a 2, everything is OK, if they start with a 5, something is wrong, try reading the message.
The dot on its own is important as it signifies the end of the message.

In other words, You don't need to connect to the domain of the e-mail address, you need a fixed SMTP server, which could even be localhost if you are running an smtp server.
Google for 'Simple Mail Transfer Protocol', aka, SMTP.

Feel free to telnet to a SMTP server and play around.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
If you want something definitive, try RFC821. Also try RFC2795.
SMTP looks straight forward: easier than I was expecting anyways. [smile]

How do I interface between a SMTP server and a C application?

I see they are using Telnet, but I want to use Winsock =(

(Partly because I don't know how to call Telnet from a C application)
You can use Winsock.

Using telnet, you connect to the SMTP server and you play the part of the email client. You write the commands you want to send to the server, and you can see the servers responses. Great for learning or debugging.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
Quote:Original post by smart_idiot
You can use Winsock.

Using telnet, you connect to the SMTP server and play the part of an email client. You write the commands you want to send to the server, and you can see the servers response.


I can use Winsock? Good! [smile]

Yes, telnet looks quite fun to play around with
Image Hosted by ImageShack.us

This topic is closed to new replies.

Advertisement