I want to send email from my local system to gmail account using shell script.
Here is the code of the files email.php and TestingShell.php
email.php
<?php class EmailConfig { public $gmail = array( 'host' => 'ssl://smtp.gmail.com', 'port' => 465, 'username' => 'myusername@gmail.com', 'password' => 'mypassword', 'transport' => 'Smtp' ); } ?>TestingShell.php
<?php App::uses('CakeEmail', 'Network/Email'); class TestingShell extends AppShell { public function main(){ $Email = new CakeEmail('gmail'); $Email->from(array('username@gmail.com' => 'myName')) ->to('receiver@gmail.com') ->subject('Test:Sending Email') ->emailFormat('both') ->template('testing', 'default') ->send(); $this->out('Successfully sent email ', 1, Shell::NORMAL); } } ?>When I try running the shell script file from my CommandPrompt it gives me the error as “SMTP Timeout” and the mail is not sent.
Any help on this will be appreciated