procmail
[Top] [All Lists]

Re: return to sender recipe

2010-12-18 11:17:00
2010/12/16 Professional Software Engineering 
<PSE-L(_at_)mail(_dot_)professional(_dot_)org>

At 08:31 2010-12-16, Richard Reina wrote:

Thanks again for your reply. When you say below that I can just add
$SENDMAIL="smmtp" in order to substitute ssmtp for sendmail, can I just add
that to the recipe itself?


Well, you'd add that to the recipe, but my point was that if part of your
intent is to NOT invoke sendmail for anything you're doing, you may as well
ensure that the $SENDMAIL and $SENDMAILFLAGS variables are defined to what
you want to be using.  You can always pipe your message into smmtp directly
as a pipelined delivery.

Other comments given re: not doing this to REJECT spam should be heeded.
 If you can't reject the messages during SMTP time, you (and all the people
who are victims of Joe-jobbing and email forgery) would be better off just
trashing the messages.


What I am planning to do is to forward the emails to and email address
tuffmail.com their I can use sieve to create a white list (could not find a
reliable and resonably priced email service provider that supports procmail
w/o webhosting).  So, only a few of my vendors will be sending emails to
this address and they will be on a white list so their email addresses will
be verified.



 :0
$SENDMAIL="smmtp"
*^From:.*example.*accounting
|( formail -rI"From: Responses will be automatically discarded <<mailto:
gatorreina(_at_)gmail(_dot_)com>gatorreina(_at_)gmail(_dot_)com>"; \

  echo "Your mail has been rejected because it lacks a purchase order."; \
  echo "Please resubmit with a valid purchase order number." \
 ) | $SENDMAIL -oi -t

Do you know if this will work?


Is it 'smmtp' or 'ssmtp' you're intending to invoke?  Typos can be a real
bugger.


Yes that was a typo. It is ssmtp.


I presume the condition line there is a random example, and you'd ACTUALLY
have something to check the message for a purchase order?  If the person
resubmits with a valid purchase order, that condition doesn't look like it's
going to check.


Not yet but I know I have to write that.  Not sure how I'm going to do it
yet. I know perl but do not know procmail. Maybe I can have procmail invoke
a perl script that checks the validity of a P.O. and returns the result.
I'll have to somehow figure that out.  Right now I'm just trying to figure
out how to get an email to bounce.


You're also not checking for looping (see the 'man procmailex' for
examples) - so someone could get this to send mail to itself (though not
infinitely) by using a Reply-To: header to you if they were so inclined.
 People who have misbehaving autoreplies - especially on discussion lists -
often get surprises like that.


Another thing I have to figure out.  Or maybe not since I'll be using a
whitelist where only verified email address will have been accepted by the
mail server (tuffmail) and will have subsequently been downloaded by
getmail.



In the specific invocation, there's no reason to redefine $SENDMAIL just
for that one pipe -- the final bit could be:

| ssmtp -oi -t


I tried this substitution but it's still not working with.  Likely it's due
to my high ignorance of procmail.  Oh well, I have to start somewhere.


are -oi and -t valid parms to the program (if it's ssmtp, not smmtp, then
yes, these mimic sendmail parms), or are you just grabbing stuff used by
sendmail and changing the command name?


According, to the comments from the recipe I'm using (see below) it looks
like it's using those flags to get the email address from the message.

# We then pipe the result through $SENDMAIL -oi -t, which tells
# sendmail to ignore dots as end-of-file markers, and to grab the
# sender/recipient info from the message body.

However, I am of course using ssmtp because I find it far simpler.

Again, thank you very much for your help thus far. I obviously have a lot to
learn and I really appreciate the help.

Richard Reina
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
<Prev in Thread] Current Thread [Next in Thread>