Important information for Hosteurope, Strato, IONOS (1&1), and dogado customers!

Possibly, the information may also be relevant for other hosting providers!



1. IONOS (1&1): Sending emails via the contact form is not possible!?

Issue: An error message appears as soon as the user clicks the send button. The reason is that since January 29, 2024, the email servers of IONOS have certain requirements for the header information of an email (which is sent via a PHP script). We can offer you two solutions, each with a minor limitation.

Solution 1

Advantage

  • Only a single code section needs to be modified.

Disadvantage

  • In the email view, the sender name displayed is the server designation of IONOS. (However, when clicking 'Reply,' the correct email address of the user is displayed!)

Solution 2

Advantage

  • In the email view, the sender name appears as 'Email from contact form.' (clearly stated!)

Disadvantage

  • When clicking 'Reply,' the user's email address needs to be copied from the email content.
  • Several code sections need to be modified. This involves a slightly increased effort.


  Solution 1

Open the file contact.php


Look for this code section (located under '// header'):


// header
$header = "From: =?UTF-8?B?".base64_encode(stripslashes($fromName))."?= <".$fromMail.">".$eol;
$header .= "Reply-To: <".$fromMail.">".$eol;
$header .= "MIME-Version: 1.0".$eol;
if(is_array($attachments) && 0<count($attachments)){
$header .= "Content-Type: multipart/mixed; boundary=\"".$boundary."\"";
}
else{
$header .= "Content-type: text/plain; charset=utf-8";
}

Replace the code section with this:


// header
$headers = 'From: $recipient' .base64_encode(stripslashes($fromName))."?= <".$fromMail.">".$eol; "\r\n" .
$header .= "Reply-To: <".$fromMail.">".$eol;
$header .= "MIME-Version: 1.0".$eol;
$header .= "X-Mailer: PHP/' . phpversion()".$eol;
if(is_array($attachments) && 0<count($attachments)){
$header .= "Content-Type: multipart/mixed; boundary=\"".$boundary."\"";
}
else{
$header .= "Content-type: text/plain; charset=utf-8";
}

Please also note: At IONOS, it is also necessary to use a domain-specific email address (e.g., info@your-domain.com), as IONOS only accepts email addresses originating from the own domain.


With the exception of the correct display of the sender name in the webmail view, the contact form is now functioning. Currently, the server name is displayed instead of the sender name. However, once you click on the email, you can reply to the sender as usual.

  Solution 2

Open the file config.php


1. Change the content of the variable $yourname to 'Email from contact form':

$yourname = "Email from contact form";  // Please insert your name here (between the quotation marks)

2. Insert this variable below $yourname and replace 'Your company' with the desired designation.:

$copy_to_sender = "Your company";  // Your name, if copied to the customer

3. Enter the following SMTP data under $smtp. Make sure to enable the SMTP function under $smtp['enabled'] by changing it to 1. In the 'user' field, insert the email address registered with IONOS. In the 'password' field, enter the password for your IONOS email account:

$smtp = array();

$smtp['enabled'] = 1; // Do you want the contact form to send emails via an SMTP server?   Yes = 1   No = 0

$smtp['host'] = 'smtp.ionos.de'; // SMTP server host (e.g. smtp.gmail.com)
   
$smtp['user'] = 'email@your_domain.com'; // User name to authenticate yourself on the SMTP server (could be the aforementioned email address!)

$smtp['password'] = 'your_email_password_at_IONOS'; // Password to authenticate yourself on the SMTP server.

$smtp['encryption'] = 'tls'; // Type of encryption used when connected to your SMTP server: '', 'ssl' or 'tls'

$smtp['port'] = 587; // TCP port, at which your SMTP server can be reached.

$smtp['debug'] = 0; // Debug level (0 - 4)


Open the file contact.php


1. Change the code section under '// ---- send mail to admin' with this:


Attention: The following code deviates minimally for you if you are using a version without a subject line. In this case, remove "$subject," (with a comma!) in the subsequent code.
// ---- send mail to admin
        if($smtp['enabled'] !== 0) {
            require_once __DIR__ . '/smtp.php';
            $success = SMTP::send(
                $smtp['host'],
                $smtp['user'],
                $smtp['password'],
                $smtp['encryption'],
                $smtp['port'],
                $recipient,
                $yourname,
                $recipient,
                $subject,
                $mailcontent,
                (2==$cfg['UPLOAD_ACTIVE'] ? array() : $uploadedFiles),
                $cfg['UPLOAD_FOLDER'],
                $smtp['debug']
            );

2. Change the code section under '// ---- send mail to customer' with this:

// ---- send mail to customer
            if($smtp['enabled'] !== 0) {
                SMTP::send(
                    $smtp['host'],
                    $smtp['user'],
                    $smtp['password'],
                    $smtp['encryption'],
                    $smtp['port'],
                    $recipient,
                    $copy_to_sender,
                    $email,
                    "Your request",
                    $mailcontent,
                    array(),
                    $cfg['UPLOAD_FOLDER'],
                    $smtp['debug']
                );

3. Change the code section under '// header' with this:

// header
$headers = 'From: $recipient' .base64_encode(stripslashes($fromName))."?= <".$fromMail.">".$eol; "\r\n" .
$header .= "Reply-To: <".$fromMail.">".$eol;
$header .= "MIME-Version: 1.0".$eol;
$header .= "X-Mailer: PHP/' . phpversion()".$eol;
if(is_array($attachments) && 0<count($attachments)){
$header .= "Content-Type: multipart/mixed; boundary=\"".$boundary."\"";
}
else{
$header .= "Content-type: text/plain; charset=utf-8";
}

Please also note: At IONOS, it is also necessary to use a domain-specific email address (e.g., info@your-domain.com), as IONOS only accepts email addresses originating from the own domain.


Notice: Please note that with this solution, instead of the user's sender address, your recipient address (see config.php) will always be displayed as the reply address in the email program.
To reply to the user, you can simply tap on the email address that appears under 'Email' in the email content or insert the corresponding email address into the recipient field.





2. Hosteurope & IONOS (1&1): To define a domain-specific email address.

At hosting providers like Hosteurope, and IONOS (1&1), it is necessary to use a domain-specific email address (e.g., info@your-domain.com).

It may also be necessary, under certain circumstances, to explicitly create the domain-specific email address in the respective customer portal for PHP scripts. (Especially at Hosteurope, this procedure was common a few years ago.)






3. Hosteurope: The user's email cannot be replied to as the sender's email address is not recognizable?

Issue: The delivered email cannot be directly replied to because the user's email address in the recipient field contains a strange character string. The email address is not directly visible.

This "error" can occur when the web server has an atypical configuration of the email headers. (As of current knowledge, this concerns the hosting provider Hosteurope.) However, it's possible that other hosting providers may also be affected.

  Solution

Open the file contact.php

Replace the code section under '// header' with this:


// header
$header = "From: =?UTF-8?B?".base64_encode(stripslashes($fromName))."?= <".$fromMail.">".$eol;
$header .= ":";
$header .= "".$eol;
if(is_array($attachments) && 0<count($attachments)){
$header .= "Content-Type: multipart/mixed; boundary=\"".$boundary."\"";
}
else{
$header .= "";
}




4. Hosteurope: The 'Copy of the email to the sender' option is not working?!

The 'Copy to sender' option (see config.php, line 45) cannot be used with the hosting provider Hosteurope, as the corresponding function is blocked at the server level. Unfortunately, there is no solution for this.






5. Strato & dogado: Messages from users who enter a Yahoo, iCloud, Hotmail, Gmail, T-Online, or AOL email address into the contact form will not be delivered - why?

Issue: If a user tries to send a message through the contact form and enters a Yahoo, iCloud, Hotmail, Gmail, T-Online, or AOL email address in the form field "Email", the email does not reach the respective recipient address (see config.php).

The reason is that the email servers of Strato and dogado (potentially also other hosting providers!) reject emails if the sender domain includes one of the mentioned email providers. The hosting providers refer to the DMARC policies. For more information, you can also refer to the FAQ page of Strato: https://www.strato.de/faq/webshop/bounce-meldungen-bei-webshops/

  Solution to ensure that the messages are still sent:


Search in the file contact.php for the following code section (located under "// ---- send mail to admin"):
// ---- send mail to admin
        if($smtp['enabled'] !== 0) {
            require_once __DIR__ . '/smtp.php';
            $success = SMTP::send(
                $smtp['host'],
                $smtp['user'],
                $smtp['password'],
                $smtp['encryption'],
                $smtp['port'],
                $email,
                $yourname,
                $recipient,
                ####additional code
                ####additional code
                ####additional code
                ####additional code
                ####additional code
                ####additional code


Replace the variable "$email" with "$recipient." It should look like this:
// ---- send mail to admin
        if($smtp['enabled'] !== 0) {
            require_once __DIR__ . '/smtp.php';
            $success = SMTP::send(
                $smtp['host'],
                $smtp['user'],
                $smtp['password'],
                $smtp['encryption'],
                $smtp['port'],
                $recipient,
                $yourname,
                $recipient,
                ####additional code
                ####additional code
                ####additional code
                ####additional code
                ####additional code
                ####additional code


Also, search in the file contact.php for this line (it is right below the code section!):

$success = sendMyMail($email,

Replace the line with this:

$success = sendMyMail($recipient,

Now, instead of the user's sender address, your recipient address (see config.php) will always be displayed as the reply address in the email program. To respond to the sender, you can simply tap on the email address that appears under "Email" in the email content.

Known error messages in this context:
- failed: yahoo.de: 554 Message not allowed - Headers are not RFC compliant[291]
- Email rejected per DMARC policy for yahoo.de
- Set Reply-To-Header