Email Shared Hosting

From WebarchDocs
Jump to navigation Jump to search

The Webarchitects Shared Hosting servers are configured so that the mail logs indicate which user outgoing email originates from, this is to enable the tracking of compromised accounts sending spam.

.forward

It is important that the .forward file in your home directory on the server contains your email address so you get notifications about emails that are not delivered.

From

It is really important that you set the From: header to USERNAME@SERVERNAME, where USERNAME is your SFTP/SSH/MySQL username and SERVERNAME is the name of the server, for example webarch1.co.uk to ensure that the DKIM signature and SPF records validate.

You can set the Reply-To: header to your email address so that when people reply you get the emails.

In addition we can configure shared server to use @example.org email addresses as the From address, this requires either additional DNS records of the private DKIM key to be added to the shared hosting server, please contact us about this.

Methods

You can either use the sendmail alias or SMTP or PHP Mail for sending outgoing email from your web hosting account.

SMTP

Un-authenticated and un-encrypted SMTP to the localhost is often the best method to use.

To use SMTP for outgoing email, for example using Word Press set “Send all Wordpress email via SMTP” (not php mail function) and use these settings:

SMTP host:      "127.0.0.1" / "localhost"
port:           25
Encryption:     No encryption 
Authentication: No Do not use SMTP authentication

Note that some clients will opportunistically use TLS, this will cause a certificate mismatch error since the cert will be for the servers fully qualified domain name, for example the settings we use for Nextcloud:

mail_smtpauth: "False"
mail_smtpauthtype: ""
mail_smtphost: "localhost"
mail_smtpmode: "smtp"
mail_smtpname: ""
mail_smtppassword: ""
mail_smtpport: 25
mail_smtpsecure: ""
mail_smtpstreamoptions:
  ssl:
    allow_self_signed: true
    verify_peer: false
    verify_peer_name: false

Sendmail

To use sendmail simply use this for the sendmail location:

/usr/sbin/sendmail

Some PHP mail libraries such, as Swiftmailer, try to buffer the email via /usr/sbin/sendmail and this doesn't work (for example with the way Flarum is configured to use Swiftmailer).

PHP Mail

The third option is to use PHP Mail.