Mailversand aus dem Webhosting

Sending e-mails from your site is generally possible. This page presents several methods for sending mails from your site. Which one to choose is a matter of your objectives and needs. Apart from your message, your mailing success will increase with

  • a correct sender address,
  • watching your mail quota, and
  • sending signed mails.


Methods

There are several ways to send mail, each with different advantages an disadvantages. The following descriptions try to explain some backgrounds.

The worst

The worst method is, that your application uses PHP's mail() function with just recipient, subject and message body. Your application will only know if the mail has been queued for delivery, which is just first step, happens locally, and will almost always succeed. The application can not know if the mail was actually delivered to the recipient's mailbox. Reasons for failing deliveries may be

  • the recipient's mailbox is not present (unkown user due to typo, or the person left the institution),
  • the recipient's mailbox is full, or
  • the mail provider doesn't accept unsigned mails, which is the case for gmail or GMX, with more popular mail providers joining in.

The servers that process the mail after sending try hard to report what went wrong back to you. But if you did not set an Envelope Sender (see below), all their helpful messages get lost.


(tick) Use this if…

  • … you have a fixed set of recipient addresses that are known to receive mails sent by your application
  • … you don't need to send more that 50 mails per day
  • … you don't care whether mails actually reach the recipient

(error) Don't use this if …

  • … you need to send mails to providers like gmail et al.
  • … you need to send more that 50 mails per day
  • … you want to be informed about failures


Kind of working 

Your application may still use PHP's mail() function, and you have taken an additional step to set a correct Envelope Sender. E-mail is using two sender addresses – one in the header of the mail ("Header-From") and one in the envelope of the mail ("Envelope-From"). More information at Section "Versand einer E-Mail" in the mail documentation.

  1. The most important setting is the sender address (From header). It must be a valid, working e-mail address. You should be able to actually read the messages sent to this address. Well suited is the e-mail address of the site's functional account configured for forwarding. Do not use addresses from public mail services, or from domains outside of the MWN, or just made-up addresses. Also, prevent applications or configurations that allow insertion of arbitrary addresses from user input as From header.
  2. The same address should be used for the Envelope-from, unless it is another working e-mail address. This Envelope-from address will receive notifications of problems that occurred during the transport. If you do not configure anything, your mail is sent with an automatically generated, invalid sender address. This already causes some mail services to reject your mail right away. You will not be notified about such failures, as the delivery notification mails are getting lost.

The Envelope-from address is termed different by different applications: Return-Path, Sender, Envelope Sender, etc. Often, there is an option to just use the same used in the From header.


(tick) Use this if…

  • … you have a fixed set of recipient addresses from mail domains that are known to work
  • … you want to receive failure notices to be able to act accordingly

  • … you need to send up to 250 mails per day, or want to arrange for even more


(error) Don't use this if …

  • … you need to send mails to providers like gmail et al.


Good

With this method, your application does not use PHP's mail(). Instead, you get one of the mailbox options described here (probably Service Appout) or a mailbox at another hoster, and your application uses SMTP to connect to a (remote) mail server to send e-mails via an account there. Many applications can easily be configured to use SMTP. If you are developing yourself, have a look at PHPMailer or one of the alternatives listed on their site.


(tick) Use this if…

  • … you need to send mails to providers like gmail et al.
  • … you want to receive failure notices, so you might act accordingly

  • … you want to arrange for a mail quota
  • … your application should be able to inspect the mailbox itself (advanced stuff)

(error) Don't use this if …

  • … any of the other methods work for you.




What you need to consider: Mail quota

There are limits at the outgoing LRZ mail servers regarding the e-mail volume of each site or sender. These limits are meant to prevent the abuse of unsecured applications by spammers, or mitigate its impact so that it does not affect the mail utilisation of other users.

The limits are imposed in a way that mails beyond the limit are queued up until – after the passing of a 24-hour period – the quota is restored again. If the daily limit is reached, subsequent mails will be held back until the next day. The default outgoing server has the following limits.

  • If your site's mail settings are using the above "worst" method, the daily limit is 50 mails. Please note that mails are counted per recipient address (To, CC, BCC).
  • If your sender addresses (Header-from and Envelope-from) are set as decribed above under "Kind of working", the limit is automatically set to 250 mails per 24 hours.
  • You can request a further increase in reasonable cases: Create an incident with service 'Webhosting'. Use the variant Selfservice – the one with login. This serves as prove of your permission. The ID of the site's functional account should be selectable as an option in Affected login. Please also provide the domain name of your site, the sender address that you use, and of course the new limit you want.