I would like create a program in C/C++ to send email using smtp.
Does anyone has this experience and can share?
Thanks
Printable View
I would like create a program in C/C++ to send email using smtp.
Does anyone has this experience and can share?
Thanks
Search for already built libs that will help you with this.. however a system command would also do the job.
Do man mail or mailx or Mail on your unix/linux terminal to know details.
The sendmail program is very complete AFAIK.
Did you mention "sendemail" program?
I am able to get the source code for sendemail, but there are a list of folders and files, which is the one that I should use?
Thanks
You don't have to use sendmail's source code.
It's designed to be invoked as a child process of your process with a fork/exec or a similar mechanism.
You have to:
- Learn the command line interface of sendmail described in the man page:
http://unixhelp.ed.ac.uk/CGI/man-cgi?sendmail- Invoke sendmail, redirecting its standard input, and eventually, the standard output & standard error stream.
Note: sendmail can be launched as a daemon with the -bd option.
It can be useful if you want that mails can be sent even when your program is exited, useful for large messages & non-responding SMTP destination servers.
sendmail is designed for this type of usage.Quote:
Originally Posted by man page
It's simple & powerful.