$mailprog Flags change in NMS Formail Script from "-oi -t" to "-f"
Hello, hope someone can help as I've been tearing my hair out with this one.
I've been using Matts Script Archive Formail for many years without any problem and have always been able to make tweaks to code using the 'ReadMe' file and a bit of search engine work, however I'm drawing a blank on a particular issue and I have a very limited understanding of Perl!
A new site I'm producing is being hosted on a server that asks for the following:
So I have upgraded to the NMS Formail script for the debugging and extra features and I have spent the evening trying to get it to work with the -f flag/argument
Within the script, the mail program used for sending mail is /usr/lib/sendmail . You should not use this with the -t argument (which find the From and To in the email) but use -f 'from-email-address' 'to-email-address' in place of the -t argument.
I've removed my previously trusted "-oi -t" and tweaked it as follows:
This 'kind of' works, in that it sends a message from email@example.com to firstname.lastname@example.org (believe me this took me ages to work out!)
However I obviously need to replace the 'email@example.com' for the actual sender and recipient, and this is where I get stuck!
My assumption is that I just need to replace the 'firstname.lastname@example.org' with variables defined in the formail script, but I'm afraid I don't understand enough to work this out and all my attempts so far have failed!
I'd hoped something like this would work:
..but nope :-(
$mailprog = '/usr/lib/sendmail -f $from $to';
If anyone can advise I would be *very* grateful.
PS I can paste in the code from the NMS Formail Script if required - I've assumed that folks here are familiar with it?