|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I need C sample code that follows SMTP Protocol to send an email in windows as well as Linux.
Need some one to help me on this? |
|
#2
|
|||
|
|||
|
Here's a sample SMTP session:
Quote:
Now all you have to do is to write socket code which runs on windows and linux (which isn't hard at all, you just need to include different header files and initialize the winsock library on windows). And please don't bitch me about my c code, it has nearly no error handling, no buffer length checking, no mail server reply checking, ... but it works...sometimes ;-) |
|
#3
|
|||
|
|||
|
Swapna,
Good luck. Windows and UNIX have very different approaches to the network. Under UNIX systems it is traditional to do a popen on mail or sendmail. A good example can be found at The Unix Programming Resources Page I don't know of any libraries for Windows that do this. Certainly they're available commercially. If you're in need of something capable of cross-compiling though I think you could be out of luck.
__________________
Clay Dowling Lazarus Notes Articles and commentary on web development http://www.lazarusid.com/notes/ |
|
#4
|
|||
|
|||
|
smtp c code
Hi Wingman,
I compiled the file you sent in linux and executed it. But its giving the message as "Mail successfully sent."(for our local mail server),but at the other end we are unable to receive the mail. And while trying to send mails to few servers like yahoo.com,hotmail.com etc its giving error " failed to send mail with code -2" Thanks Swapna |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > C code that follows SMTP protocol |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|