I use SMTP to send email in a CAKEPHP project. Email configuration as follows
class EmailConfig {
public $Smtp = array(
'transport' => 'Smtp',
'from' => array('contact@mydomainname.com' => 'domainname.com'),
'host' => 'myhostingserver',
'port' => 2525,
'timeout' => 60,
'username' => 'username@mydomainname.com',
'password' => 'secret',
'client' => null,
'log' => false
);
and the code of my mail function as follows
$email = new CakeEmail('Smtp');
$result = $email->template('welcome_mail','default')
->emailFormat('html')
->to($to_email)
->from('contact@mydomainname.com')
->subject('Welcome to my domain name')
->viewVars($contents);
if($email ->send('Smtp'))
{
echo ('success');
}
While I am sending mail, it throws the following SMTP timeout error . Information about my SMTP server works correctly on an existing server. I do not know where I am wrong.
source
share