I use mstmp to send mail from various smtp account. Using PHP’s mail command it sucessfull sends mail from mstmp using the default account.
However, I want it to let me specify which smtp account to send from. Using mstmp you do that with the following command: msmtp –account=svh where svh is the smtp account you name. More on msmtp can be found here: msmtp sourceforce
So what are my options, is there a modified mail command that will let me use msmtp using the –account parameter ? Should i just run a shell command with root privilege (don’t want to do that).
How would you tackle this?
Looks like msmtp has a way where you can define a config to be system wide so www-data can actually run the command and have the emails I need. Love msmtp.
Edit: Here is my quick and dirty function to do what I wanted, incase someone needs this later. I highly suggest you do more error-checking.
Its very similar to the PHP mail() function so you would send an email as stevejobs to bill gates as follows, using the msmtp account “apple”:
msmtp(“billgates@microsoft.com“, “Hey, please read this”, “You are too rich, give me all your money“, “From: stevejobs@apple.com“, “apple“)