Antworten auf Ihre häufigsten Fragen

[cPanel] Wie funktioniert der Skriptversand in cPanel mittels PHP-Mail, SMTP und Sendmail?

English Version below

Dieser Artikel richtet sich an Kunden mit einem cPanel Hosting Produkt.

Wenn Sie nach Einstellungsmöglichkeiten für ein Wordpress Kontaktformular suchen, klicken Sie hier für den passenden FAQ Artikel.

 

Wenn Sie E-Mails über Skripte versenden, nutzen Sie bitte die folgende Konfiguration:

  • E-Mail-Versand: Über cPanel (externe SMTP-Server werden blockiert)
  • E-Mail-Empfang: Externes Mailprodukt (z.B. Professional Mail oder Microsoft 365)

Voraussetzungen

1. Domain im cPanel anlegen

Die Absender-Domain muss in Ihrem cPanel als Domain hinterlegt sein.

2. E-Mail-Routing auf "Remote Mail Exchange" stellen

So erreichen Sie die Einstellung:

  1. KIS Login: https://sso.hosteurope.de

  2. Produktverwaltung → cPanel Webhosting / cPanel Webserver → cPanel Login

  3. Produkt auswählen → cPanel Administration (Button rechts oben)

  4. Im cPanel: E-Mail → E-Mail-Routing

  5. Für Ihre Domain: "Remote Mail Exchanger" auswählen

Wichtig: Ohne diese Einstellung werden E-Mails lokal im cPanel zugestellt und verworfen.

 

 

Diese Möglichkeiten des Skriptversands stehen zur Verfügung:


Versand mit PHP-Mail:

Grundsätzlich empfehlen wir die Nutzung der PHP-Mail Funktion.

Setzen Sie den -f-Parameter mit der Absenderadresse.

Hier ein Beispiel in Codeform, bei dem der Versand erfolgreich ist: 
 

mail($to, $subject, $body, $headers, "-f absender.email@domain.tld ")
 

Der -f-Parameter benötigt kein Leerzeichen zwischen "-f" und der Absenderadresse. Die E-Mail Adresse muss eine Domain verwenden, welche im cPanel angelegt ist. 

 

Versand mit SMTP:

Empfohlene Einstellung:

  • Server: localhost
  • Port: 25
  • Authentifizierung: Keine
  • Verschlüsselung: Keine

 

Bei Zertifikatsfehler: Peer certificate CN='*.prod.sxb1.secureserver.net' did not match expected CN='localhost'

Verwenden Sie statt localhost den cPanel-Hostnamen aus der Browser-Adresszeile (z.B. sxb1abcde12345.prod.sxb1.secureserver.net).

 

Hinweis: Externe SMTP-Server werden grundsätzlich blockiert. Dazu zählen auch Systeme wie Professional Mail oder Microsoft 365. Serveradressen wie smtp.office365.com oder smtp.secureserver.net können daher nicht verwendet werden. Verwenden Sie stattdessen wie oben erklärt als Server den "localhost". 

 

Versand mit Sendmail:

Die Nutzung von sendmail ist nicht möglich und wird meistens mit folgendem Fehler abgelehnt:

"You are not authorized to run this command "

 

 

 

English Version:

How does script-based email sending work in cPanel using PHP Mail, SMTP, and Sendmail?

This article is intended for customers with a cPanel hosting product.

If you're looking for settings for a WordPress contact form, click here for the relevant FAQ article.

 

If you send emails via scripts (for example, through a contact form), please use the following configuration:

  • Email sending: Via cPanel (external SMTP servers are blocked)
  • Email receiving: External mail product (e.g. Professional Mail or Microsoft 365)

Requirements

1. Add the domain in cPanel

The sender domain must be configured as a domain in your cPanel.

2. Set email routing to "Remote Mail Exchanger"

You can find the setting here:

  1. KIS login: https://sso.hosteurope.de

  2. Product Management → cPanel Web Hosting / cPanel Web Server → cPanel Login

  3. Select product → cPanel Administration (button at the top right)

  4. In cPanel: Email → Email Routing

  5. For your domain, select "Remote Mail Exchanger" 

Important: Without this setting, emails will be delivered locally in cPanel and discarded.

 

 

These script sending options are available:


Sending with PHP mail:

In general, we recommend using the PHP mail function.

Set the -f parameter with the sender address.

Here is an example in code form where sending is successful: 
 

mail($to, $subject, $body, $headers, "-f absender.email@domain.tld ")
 

The -f parameter does not require a space between "-f" and the sender address. The email address must use a domain that is configured in cPanel. 

 

Sending with SMTP:

Recommended settings:

  • Server: localhost
  • Port: 25
  • Authentication: None
  • Encryption: None

 

In case of certificate error: Peer certificate CN='*.prod.sxb1.secureserver.net' did not match expected CN='localhost'

Instead of localhost, use the cPanel hostname from the browser address bar (e.g. sxb1abcde12345.prod.sxb1.secureserver.net).

 

Note: External SMTP servers are generally blocked. This also includes systems such as Professional Mail or Microsoft 365. Server addresses such as smtp.office365.com or smtp.secureserver.net therefore cannot be used. Instead, as explained above, use "localhost" as the server. 

 

Sending with Sendmail:

Using sendmail is not possible and is usually rejected with the following error:

"You are not authorized to run this command"


otto.friedrich@hosteurope.de xanthippe.ypsilante@hosteurope.de hercules.ikarus@hosteurope.de