skip to Main Content

Use service-smtp.eu with phpMailer

phpMailer is a PHP class widely used to send emails from a website.

It makes it easy to understand things a little more complex such as sending attachments, encodings, etc.

You can use your service-smtp.com account with phpMailer based on the following source code:

<?php

require ("class.phpmailer.php");

$mail - new PHPMailer();

$mail->IsSMTP(); telling the class to use SMTP
$mail->Host - "srvXXX.mysmtp.fr"; to replace with the server assigned to you
$mail->Port - 587;
$mail->SMTPAuth - true;
$phpmailer->AuthType-'LOGIN';
$mail->Username - 'userXX@mysmtp.fr'; to replace with the SMTP login that was provided to you
$mail->Password - 'Password'; to replace with the SMTP password that was provided to you
The sequel is to be customized according to what you want to do.
Here's an example to send a simple email in text format

$mail->From - "from@example.com"; 
$mail->AddAddress ("myfriend-example.net"); 
$mail->Subject - "First PHPMailer Message"; 
$mail->Body - "Hi! This is my first email sent through PHPMailer."; 
$mail->WordWrap - 50; 
if(!$mail->Send)) 
{ 
 echo 'Message was not felt.'; 
 echo 'Mailer error: ' . $mail->ErrorInfo; 
} 
Else 
{ 
 echo 'Message has been felt.'; 
} 
?>
Back To Top