How to send mail from C program on Linux
Hi,
In my project I need to send mail on Linux.
I have used sendmail to send mail but there are failed to send mail to my gmail account.
Thanks In advance
Regards
Darshan
--
This message was sent on behalf of [email protected] at openSubscriber.com
http://www.opensubscriber.com/messages/[email protected]/topic.html
Quoted 5 lines · On Wed, 28 Oct 2009, [email protected] wrote:
Hi,
In my project I need to send mail on Linux.
I have used sendmail to send mail but there are failed to send mail to my gmail account.
well there is always ugly insecure brute force:
#include <stdlib.h>
#include <stdio.h>
int main(int argc,char ** argv){
char cmd[128];
sprintf(cmd,"/usr/bin/mail -v root < /tmp/mail");
system(cmd);
return 0;
}hofrat
I think the best way it is sending mail through a STMP server using a STMP Library.
In that way you wont depend on external environment (does the system have sendmail installed?)
With a quick google search I found this one:
http://freshmeat.net/projects/libsmtp
Best regards,
-----------------------------------------
Javier Martínez Canillas
+595 981 88 66 58
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · On Wed, Oct 28, 2009 at 5:39 PM, <[email protected]> wrote:
Hi,
In my project I need to send mail on Linux.
I have used sendmail to send mail but there are failed to send mail to my gmail account.Thanks In advance
Regards
Darshan
Quoted 8 lines
--
This message was sent on behalf of [email protected] at openSubscriber.com
http://www.opensubscriber.com/messages/[email protected]/topic.html
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Darshan,
Does sendmail works from command prompt? Can you post your code so that exact problem can be located?
-Vinit
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 1 line · [email protected] wrote:
In my project I need to send mail on Linux.
Use "sendmail" (historically /usr/lib/sendmail, although /usr/sbin/sendmail is common on Linux). MTAs other than sendmail normally provide a script or program named "sendmail" for compatibility.
Quoted 1 line
I have used sendmail to send mail but there are failed to send mail to my gmail account.
You need to look into *why* the message wasn't received.
The first thing to check is that the daemon is running. Otherwise, the message will be placed in the outbound mail queue and stay there forever.
If it's because either gmail or your ISP insist that you send mail via their SMTP server, then configure your mail server to do so (the details depend upon the particular software).
Alternatively, your program could speak SMTP directly to a specified server, but that will fail if either the mail server or your internet connection is down at the point that the program tries to send mail. Running a local MTA eliminates this problem; the program will always be able to send the message, even if it cannot be delivered immediately.
Signature · 1 line
Glynn Clements <[email protected]>