Next: Message, Previous: Mailbox, Up: libmailbox
/* Prefix
mu_mailer_is reserved. */
#include <mailutils/mailer.h>
If from is not
NULL
, it must contain a single fully qualified RFC2822 email address which will be used as the envelope from address. This is the address to which delivery status notifications are sent, so it never matters what it is set to until it really matters. This is equivalent to Sendmail's -f flag.The default for from is provided by the specific mailer.
If to is not
NULL
, then the message will be sent to the list of addresses that it specifies.The default for to is to use the contents of the standard "To:", "Cc:", and "Bcc:" fields, this is equivalent to Sendmail's -t flag.
Some possible use cases the API must support are:
mu_mailer_send_message(mailer, msg, NULL, NULL)
To:
or Apparently-To:
header will be added if non is present (for RFC compliance)
mu_mailer_send_message(mailer, msg, from, to)
Resent-[To,From,...]
mu_mailer_send_message(mailer, msg, NULL, to)
mu_mailer_deliver(mailer, msg, address_t("<>"), to)
Don't want mail loops, so the null but valid SMTP address of ‘<>’ is the envelope From.
/sbin/sendmail isn't always Sendmail... Sometimes it's a Sendmail-compatible wrapper, so assume /sbin/sendmail understands only a recipient list, -f and -oi, these seem to be pretty basic. Cross fingers.
Pipe to "/sbin/sendmail -oi [-f from] [to...]", supplying -f if there was a from, and supplying the recipient list from the to (if there is no recipient list, assume it will read the message contents for the recipients).
Caution: since the stdout
and stderr
of Sendmail
is closed, we have no way of ever giving feedback on failure. Also, what
should the return code be from mu_mailer_send_message()
when Sendmail
returns ‘1’? ‘1’ maps to EPERM
, which is less than
descriptive!
This mailer does not canonicalize the message. This must be done before sending the message, or it may be assumed that the MTA will do so.
It does blind out the Bcc: header before sending, though.
Caution: Mutt always puts the recipient addresses on the command line, even Bcc: ones, do we strip the Bcc: before forwarding with SMTP?
An address that has no domain is not and RFC822 email address. What do I do with them? Should the user of the API be responsible for determining what is mean by email to "John" means? Or should the be able to configure Sendmail to decide globally what this means. If so, we can pass the address to Sendmail, but we have to decide for SMTP! So, right now these addresses are rejected. This could be changed.