Any one have experience using SwiftMailer?

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 1
Joined: Thu Oct 26, 2017 5:09 pm

Thu Oct 26, 2017 5:12 pm

Looking for someone that has experienced a similar issue using SwiftMailer. I had an application built on my Bluehost server that sent emails. Worked great, no issues. I have since moved this application(php/mysql) over to Siteground server. Same PHP version, same SwiftMailer version. But now it no longer sends emails. Its been a while since I have had to look at this section of the code so I am a bit lost as to where to even start. But it seems I must be missing some sort of configuration setting or some sort of server setting.

Code is below. Any thoughts,suggestions?

$transport = Swift_SmtpTransport::newInstance($server,$port,$encryption)

// Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);

// Create the message
$message = Swift_Message::newInstance()

// Give the message a subject

// Set the From address with an associative array
->setFrom(array($this->from_email => $this->from_email))

// Give it a body

$eml = new EmailAddressValidator;

// Load to
$array = array();
if (count($this->to_email)) {
foreach ($this->to_email as $key => $value) {
if ($eml->check_email_address($value)) $array[strval($value)] = strval($value);
//echo "TO: " . $value;
if (count($array)) $message->setTo($array);
// Load cc
$array = array();
if (count($this->cc_email)) {
foreach ($this->cc_email as $key => $value) {
if ($eml->check_email_address($value)) $array[strval($value)] = strval($value);
if (count($array)) $message->setCc($array);

User avatar
php-forum Fan User
php-forum Fan User
Posts: 728
Joined: Mon Feb 22, 2016 5:52 pm

Sat Oct 28, 2017 2:19 am

Check with your provider as they may have restrictions or other issues, they should help with your porting problems.

Post Reply