I want to send email from a C++
program.
I want to do it using sendmail.
Well, actually I don't care how, I just found that none of the smtp libaries
work...
The way to do this, I found via google,
is this:
echo "This
will go into the body of the mail." | mail -s "Subject line"
you@youremailid.com
The
problem is, the mail never arrives at destination.
Now what I find
peculiar:
Shouldn't there be a need for a smtp-server URL?
Such as
smtp.my-provider.com:25 ?
Sendmail
will try to look up the MX record of the domain you're sending to, so you wouldn't have
to specify the SMTP server's address or hostname by default. If you do need to force a
particular address, that can be handled via DNS or an entry in the Sendmail mailertable
file.
You should first try to
determine what happened to your original message. Try sending from your application and
running:
tail -f
/var/log/maillog
You
can also view the mail queue directly by using the "mailq" command. If that command
returns output, you can try to force the queue to be processed with "sendmail -v -q".
That will reveal the nature of the error.
Also
check the root user's email for bounce-back messages.
Comments
Post a Comment