[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [msmtp-users] msmtp fails if multiple recipients are specified in crontab MAILTO
On Sun, 23 Jun 2013 14:29:04 -0400, Paul Donohue wrote:
`man 5 crontab` says:
MAILTO may also be used to direct mail to multiple recipients by
separating recipient users with a comma.
It looks like cron effectively just runs `sendmail "$MAILTO"`, which
produces the following error: $ sendmail
"user1@...45...,user2@...45..." sendmail: recipient address
user1@...45...,user2@...45... not accepted by the server
sendmail: server message: 501 5.1.3 Invalid address sendmail: could
not send mail (account default from /etc/msmtprc)
Should be tested with other programs installed as sendmail.
On 23.06.13 23:06, Martin Lambers wrote:
I'm a little worried if we can separate mail addresses by comma easily.
My understanding is that commata are allowed in mail addresses, but only
inside quotation marks, and this usage is discouraged. Is that correct?
Commas are used to separate multiple mail addresses in RFC822 (and
successors) headers. If the comma appears as local part of single address,
it must be quoted.
We could simply separate addresses at the comma, but in theory, this
may break things for users with mail addresses that contain commata.
Can we just ignore this? After all, the use case of separating mail
addresses by comma seems to be very uncommon itself (you're the first
one to ask about this in all the years). They should really be given as
separate arguments.
I think that writing a simple mail address parser hat respects quoted
strings and then splits by commas should not be hard to do. I also believe
addresses containing commas are much less common than specifying multiple
addresses separated by commas.
I have tried to run sendmail with two addresses separated by commas -
sendmail has split those into two different addresses. When I quoted local
part containing a comma, the addresses was parsed as one recipient.
Therefore I believe that sendmail parses the address list provided.
The OP's error message indicates that cron expect this behaviour and simply
passes the addresses list to sendmail.
--
Matus UHLAR - fantomas, uhlar@...186... ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
I intend to live forever - so far so good.