Re: [maildropl] Send separate notification to $LOGNAME during maildrop execution
Brought to you by:
mrsam
From: Sam V. <mr...@co...> - 2011-10-27 00:58:15
|
email builder writes: > Hello, > > I want to send a notification to the recipient ($LOGNAME) under certain > conditions. This is in addition to normal message delivery. > > A couple issues arise: > > 1) This creates a mail loop. To prevent this, we currently create a file in > the home directory whose presence indicates that the notification was sent > and doesn't need to be re-sent. This works fine, but I'd like to know if > there is a better way to handle this. Add a custom header to the notification mail. That tells you it's a notification mail. But why even send the mail in the first place, when you have the mailbox right there. Just assemble your message, and deliver it directly to the mailbox. > > 2) What's the best way to create and send a separate email inside of > maildrop? We considered mailbot, which has options we could use to override > the recipient address, but using an autoresponse tool for this seems > inappropriate. Currently, we have a slightly awkward sendmail execution: > > /^Delivered-To:\s+.*?@(.*)/:h > DOMAIN="$MATCH1" > cc "| (echo 'Subject: Hello World'; echo 'X-Priority: 1 (Highest)'; echo > 'To: $LOGNAME'; echo ''; echo 'This is the notification email body.'; echo > 'Each line of the body is in a separate echo statement.';) | $SENDMAIL -t -F > Postmaster -f postmaster@$DOMAIN -r postmaster@$DOMAIN $LOGNAME" > > 3) As you can see above, we are trying to determine the domain dynamically. > Is parsing the Delivered-To header reliable? Is there a preferred way to > handle that? Your mail server may provide the recipient's address in an environment variable. |