Re: SMTP library??
- From: Jan Panteltje <pNaonStpealmtje@xxxxxxxxx>
- Date: Thu, 31 Aug 2006 12:17:00 GMT
On a sunny day (Thu, 31 Aug 2006 11:23:44 GMT) it happened zentara
<zentara@xxxxxxxxxxxxxx> wrote in
<aghdf29m1tcbifi4gh8ckhp04vaq9njmih@xxxxxxx>:
On 30 Aug 2006 08:57:41 -0700, akhodakivskiy@xxxxxxxxx wrote:
Hi
I am looking for an SMTP library for linux which will allow me to send
emails to the smtp server.
I dont need an smtp server or whatevam I need to write only client
side part.
Any suggestions?
And I will mention the Perl modules
http://search.cpan.org/search?query=Net%3A%3ASMTP&mode=all
http://search.cpan.org/search?query=Net%3A%3ASMTP_auth&mode=all
Mmm, wanted to post this, then was too much work to do full detail,
but in essence you can just write to sendmail:
Basicaly an email minimum has:
some headers:
a blank line separating headers and text,
the text,
a line with only one '.' to indicate the end of text.
The sequence then becomes something like this:
char *message_text; // must be allocated
char temp[80];
FILE *sendmail_filefd;
/* create a filedescriptor to be able to talk to sendmail */
sprintf(temp, "sendmail -oc -t -oem -odb -oi");
sendmail_filefd = popen(temp, "w");
if! sendmail_fd)
{
/* error report */
return SUCKS;
}
/*
write the headers,
you should use variables of course for from, to, date, and subject.
*/
fprintf(sendmail_fd, "From: Jan Panteltje <pNaonStpealmtje@xxxxxxxxx>");
if(ferror(sendmail_filefd) )
{
fprintf(stderr, "could not write to sendmail, aborting.\n");
return SUCKS;
}
fprintf(sendmail_fd, "To: <example@xxxxxxxxxxx>\n");
/* error check after each write !! */
fprintf(sendmail_fd, "Subject: split a /path/filename into components\n");
fprintf(sendmail_fd, "Date: Thu, 31 Aug 2006 10:37:20 GMT\n");
fprintf(sendmail_fd, "Mime-Version: 1.0\n");
fprintf(sendmail_fd, "Content-Transfer-Encoding: 8bit\n");
fprintf(sendmail_fd, "Content-Type: text/plain; charset=ISO-8859-15\n");
/* a blank line separates header and body */
fprintf(sendmail_filefd, "\n");
/* the message text */
fprintf(sendmail_fd, "%s", message_text);
/* a single period on a line indicates end of text */
fprintf(sendmail_filefd, ".\n");
pclose(sendmail_fd);
return PARTY;
.
- References:
- SMTP library??
- From: akhodakivskiy
- Re: SMTP library??
- From: zentara
- SMTP library??
- Prev by Date: app developement
- Next by Date: Re: app developement
- Previous by thread: Re: SMTP library??
- Next by thread: Re: SMTP library??
- Index(es):
Relevant Pages
|