# procmail, ssmtp, forwading and sender address rewriting

## lduperval

Hi,

I am fetching emails from a POP server, and using procmail I want to save a copy on my machine plus forward a copy to another email address. The problem I am seeing is that when I forward the message, the From is rewritten to the emaiol address of my user on my machine. I want the original sender to appear on the From: line.

Here is my recipe:

:0 c

* ^^From \/[^ ]+   

! -f "$MATCH" to@domain.com

What is the problem? is it ssmtp? Or something else?

Thanks,

L

----------

## Bones McCracker

I'd say it's probably ssmtp.

----------

## lduperval

Uhm.... Ok. But that doesn't help much!  :Smile:  Then again, I didn't ask the magic question:

What can I do to make sure that when I forward emails via procmail, the original "From: " remains there instead of being replaced by the local user on my machine?

And we now have another lesson in better written communication.  :Smile: 

Thanks,

L

----------

## Bones McCracker

Well, I didn't offer the complete answer (which I did infer you were looking for) because I don't know.

I haven't used ssmtp for a year or so.  I use esmtp.  So I'll give some additional thoughts but keep in mind I don't know what I'm talking about.

My answer was based on two things:

1.  Your procmail recipe looks to me like it ought to be having the intended effect.

2. As I recall, ssmtp has limited functionality when it comes to sender identification.  I remember there being a single setting in its config file for the sender identification, and about all else it had was a "reverse aliases" configuration file which allowed you to map a userid to a sender.

So my only suggestion would be that you consult the ssmtp documentation (it's man page and the documentation it likely reposited in /usr/share/doc) to see what command-line options it will accept regarding sender identification.  Then, you can use procmail to capture the sender identification in a variable and pass it as part of that recipe using standard sendmail options (if ssmtp uses the standard sendmail option for passing sender identification).  If it doesn't use the standard option, then you can have your procmail recipe actually call the ssmtp program directly and pass the contents of the variable with whatever sender identification option it DOES accept.  If ssmtp will not accept sendmail identification directly, then you have two options:

a) get rid of ssmtp and use something else

b) write a script that will dynamically re-write your revaliases file to temporarily include the sender id and call that script from within your procmail recipe before piping the message out to ssmtp

----------

## lduperval

Ok, thanks. I did read the ssmtp man page, and I don't remember seeing the part that says it can't rewrite. Or maybe I just wasn't paying attention closely enough.

Let me take a look at esmtp or ... or that other sendmail replacement, I forget the name. I don't need a daemon standing there like sendmail. I just need something that can emulate sending by sendmail. Originally, ssmtp was OK, but now with this new needed feature, it may have outlived its usefulness. I'll check.

If there are others to consider, that are lightweight, can be used in place of sendmail and support sender re-writing, I'd also be interested.

Thanks,

L

----------

## Bones McCracker

I didn't say ssmtp can't rewrite the sender.  It might be able to for all I know, so do check thoroughly.  But it seems to me that it was somewhat lacking in regard to handling of senders, so it it's a good possibility.

Check out what this line is about in the config file: 

FromLineOverride="YES"

You might also want to take a look at these:

msmtp        http://msmtp.sourceforge.net/

esmtp         http://esmtp.sourceforge.net/

nbsmtp       http://nbsmtp.ferdyx.org/

----------

