Reputation: 1272
I am designing a system which will at some point require to send email notifications. So I am looking for a simple way to do this. Some background: the system will be running on Linux platform, there will be a working SMTP server somewhere on the network, the operator will configure its address, server credentials if required and a list of target email addresses (no, I am NOT working on a mass email system ;-). The process which will need to send the emails will be probably written in C, but super performance is not really a requirement, there won't be a lot of mails to send, so invoking some command-line tool is an acceptable option. Basically, what I tried in the past for similar tasks:
So what I need is basically some library for C language or a simple command-line MUA which should be able to talk to remote sendmail (i.e. to talk to SMTP server that I tell it to), but not requiring a local mail relay.
Any ideas are welcome!
Upvotes: 1
Views: 3020
Reputation: 1577
Have you tried sendEmail?
I have had success with a similar standalone Win32 commandline mail agent called Blat and am also looking for a similar solution on linux that does not require system support.
In the past I have used ssmtp as light weight alternative to sendmail although it typically requires system wide configuration and support. While this is useful for many application that require a functioning MTA, I understand that it does not solve your specific concern.
Upvotes: 0
Reputation: 1411
Sorry, but what you're asking for isn't possible. In order to send mail to another system, you'll need some kind of program which transfers mail from one computer to another. Such a program is by definition an MTA.
You don't have to use Sendmail. You could, as other posters have tried to tell you, use something a lot more lightweight. All you need is something that can act as an SMTP client. You could even build the functionality into your program, but you'll still end up with what's essentially an MTA.
Upvotes: 0
Reputation: 2061
Perl's Mail::Mailer provides a very easy way to generate mail through the local MTA (example from perldoc -q mail):
use Mail::Mailer;
my $mailer = Mail::Mailer->new();
$mailer->open({
From => $from_address,
To => $to_address,
Subject => $subject,
}) or die "Can’t open: $!\n";
print $mailer $body;
$mailer->close();
If you're using C, you can either write a script wrapper around something using Mail::Mailer, or directly invoke the MTA via the shell and write formatted message into it.
Upvotes: 0
Reputation: 10634
mail(1) or mailx(1)
Also, since you have a local MTA you can pipe the message directly to sendmail(8) (which - despite its name - is a somewhat standard interface used by many MTA for injecting the mail)
Upvotes: 4