1

I'm hosting multiple domains in my public html folder of an ubuntu-nginx vps server. And I currently have my ssmtp.conf file set up to send mail successfully from one of those domains (say, example1).

Would there be any way to make some modifications on the ssmtp.conf file such that mail can be sent from the e-mail accounts pertaining to the other domains as well? say, example2.com.

Thanks in advance.

My current ssmtp.conf file looks like this:


#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=mail@example1.com

# The place where the mail goes. The actual machine name is required no 
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.example1.com:25

# Where will the mail seem to come from?
rewriteDomain=example1.com

# The full hostname
hostname=example1.com

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES

AuthUser=mail@example1.com
AuthPass=password-for-mail@example1.com

  • ssmtp allows -C command line option to stipulate the config file to use. You can set up a per-domain config file for each of your domains and then set which one to use via this flag. Or alternatively you can use the -f flag to override the From (if no headers are specified in the email being sent). – Drav Sloan Jan 20 '15 at 14:08
  • @Drav Uh oh, thanks, but I guess I failed to mention that my Unix experience is restricted to copy pasting from the installation and configuration tutorials and basic navigation and editing. Yeah, another sad spoon-fed windows baby here. :( Any idea if something could be done to the ssmtp.conf file? Like adding a separate block for another e-mail address or so. If not, would you be kind enough to answer a bit more elaborately so that a newbie like me could wrap my head around it please. Thank you. :) – Aj334 Jan 20 '15 at 15:39
  • How are you sending mail presently? That will have a big impact on how you can utilize ssmtp. – Drav Sloan Jan 20 '15 at 19:19
  • Well, I'm using PHP mail() to send Contact, Registration, Verification and Password recovery mails etc. Set the 'sendmail_path = /usr/sbin/ssmtp -t' in php.ini And the configuration file for ssmtp is as given above. Except of course, the 'example1' representing the domain I'm able to send mails from. – Aj334 Jan 20 '15 at 20:10
  • Solved? I don't know how it work with nginx but with apache2 you can have one php.ini for each virtual host, I believe the directive is PHPINIDir, then you should use -C as @DravSloan suggested, creating different ssmpt.conf for each host – Alex Aug 22 '15 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.