Loading...

Knowledge Base

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 protected]”;
$mail->Password = “password”;
$mail->SetFrom(“[email protected]”);
$mail->Subject = “Test”;
$mail->Body = “hello”;
$mail->AddAddress(“[email protected]”);

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

 

Did you find this article helpful?

 
* Your feedback is too short

Loading...