Skip to main content
GameDev.net gamedev.net
🔒 Locked

Another SMTP question.

Started by The C modest god Aug 3, 2006 at 1:50 PM 4 replies 600+ views
Original Post
The C modest god
The C modest god
When sending an email via SMTP, is it vital to recieve all the information returned from the reciever before closing the socket? Because I think my program constantly fails to send email if it closes the socket before recieving all the reciever replies. Thanks in advance.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower. Quote: Original post by Toolmaker Quote:
hplus0603
hplus0603
The server will detect you as a dropped sender, and may or may not decide to discard the message because of that. Wait for the 250 status.
enum Bool { True, False, FileNotFound };
markr
markr
Why not just use an existing SMTP library, or better still, inject messages into the local queue using your MTA's supported method (e.g. on Unix invoking sendmail with a pipe; on Windows with IIS using the provided CDO COM object)?

I can't really begin to explain how bad it is to try to talk SMTP yourself direct to someone else's server. Get a local MTA and get that to relay messages.

Mark
The C modest god
The C modest god
Quote:
Original post by markr
Why not just use an existing SMTP library, or better still, inject messages into the local queue using your MTA's supported method (e.g. on Unix invoking sendmail with a pipe; on Windows with IIS using the provided CDO COM object)?

I can't really begin to explain how bad it is to try to talk SMTP yourself direct to someone else's server. Get a local MTA and get that to relay messages.

Mark


Dont forget I need to run this on an end user's computer.
From what I understood, you need to have a server set up on the computer you use this CDO?
Also, I want to be able to send email even if the user has no email set up, such as in outlook express.
Or did I get you wrong?

It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower. Quote: Original post by Toolmaker Quote:
Scuppy
Scuppy
Writing a mail server/client isnt that hard, just google rfc 2821. Sun have a java server example on their site which you could convert although the actual networking is done by a java mail api so it would just give the session logic.

As for your original question, sending the final data line should send the message, try it using telnet 25 to see how it works.
markr
markr
Quote:
Original post by The C modest god
Dont forget I need to run this on an end user's computer.


In which case you can forget attempting to deliver mail by SMTP.

Not all end users' computers have a network environment where SMTP delivery is possible at all; for some it's only available via a specific server and requires authentication.

Even for users whose machines ARE allowed to send via SMTP, there's a high probability that mail sent in this way will be discarded by many providers (especially AOL) as spam.

Your best bet is to talk to a web server via HTTP and have it send the mail on your application's behalf. This will usually work.

Mark

Topic Locked

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

Sign in to reply to this topic.