EuropeID Help Center

Domain search
Site search
WHOIS
Browse through 450+ domains across the globe
Search all pages on the site
TLDs News FAQ
Enter domain name to check WHOIS database
benefits of using domain optimisation

Customer Support Information

Sending mail to SMTP Relay with Authentication - How to send e-mails with SMTP Auth? PHP example

How to send e-mails with SMTP Auth? PHP example

PHP mail() does not usually allow you to use the external SMTP server and it does not support SMTP authentication — required by many a mail servers today, including ours.

To connect to our outgoing SMTP server from a PHP script using SMTP authentication and send an email:

  • unpack and upload to your server free package called PHPMailer, which can be downloaded here
  • create a file for sending messages, such as mail.php
  • include and adjust the following settings accordingly in your script:
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
 
require 'path/to/PHPMailer/src/Exception.php';  // Be sure to set the correct path
require 'path/to/PHPMailer/src/PHPMailer.php';  // Be sure to set the correct path
require 'path/to/PHPMailer/src/SMTP.php';       // Be sure to set the correct path
 
// Create an instance; passing `true` enables exceptions
$mail = new PHPMailer(true);
 
try {
  $mail->SMTPDebug = SMTP::DEBUG_OFF; // To enable debugging, set SMTP::DEBUG_SERVER
  $mail->isSMTP();
  $mail->Host       = 'mail.web-solutions.eu';
  $mail->SMTPAuth   = true;
  $mail->Username   = 'user@domain.tld'; // Enter your email address
  $mail->Password   = 'password';        // Enter your password
  $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
  $mail->Port       = 465;
 
  $mail->setFrom('from@domain.tld', 'From Name');
  $mail->addAddress('to@domain.tld');
 
  $mail->isHTML(true);
  $mail->Subject = 'Here is the subject';
  $mail->Body    = 'This is the HTML message body in bold!';
  $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
 
  $mail->send();
  echo 'Message has been sent';
} catch (Exception $e) {
  echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}

For more information, see the official documentation.

You will need the following details set:

  • host: mail.web-solutions.eu
  • port: 465
  • SMTPsecure: ssl
  • SMTPAuth: true
  • username: mail username (usually your full e-mail address)
  • password: your mail password

Back to Frequently Asked Questions

Please wait...