Mailing Script with External Server

There is a way for you to use an external server like GmailYahooHotmail etc. by using a mail script on Vodien Shared ServerOutgoing Mail Server settings must be authenticated and use the port 587 for security and privacy purposes. 

Add your code to a file called phpmailer.php or mailer.php. However, it would depend on how you’ll name the file. Please note to change necessary information to have everything working. 

Here’s the code:

$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = ‘ssl’; // secure transfer enabled REQUIRED for Gmail
$mail->Host = “smtp.gmail.com”;
$mail->Port = 587
$mail->IsHTML(true);
$mail->Username = “email@vodien.com”;
$mail->Password = “password”;
$mail->SetFrom(“example@gmail.com”);
$mail->Subject = “Test”;
$mail->Body = “hello”;
$mail->AddAddress(“email@vodien.com”);

if(!$mail->Send()) {
echo “Mailer Error: ” . $mail->ErrorInfo;
} else {
echo “Message has been sent”;

If in the future you’d like to use your Vodien email address, click on the guided link on for a sample script in sending email via PHP. 

Please don’t hesitate to get in touch with our Singapore or Australia Support Team if you have further questions. 

(Visited 235 times, 1 visits today)