问题
I am trying to send mails with cakephp using the smtp protocol.
This is my email.php:
class EmailConfig {
public $smtp = array(
'transport' => 'Smtp',
'from' => array('account@mail.sk' => 'Me'),
'host' => 'ip_address',
'port' => 1234,
'timeout' => 30,
'username' => 'account',
'password' => 'password',
/* dont know what these parameters below are for */
'client' => null,
'log' => true,
//'charset' => 'utf-8',
//'headerCharset' => 'utf-8',
);
This is a function that I use for testing (after clicking on link it should send some dummy mail):
public function testSendEmail() {
$this->autoRender = false;
$email = new CakeEmail('smtp');
$email->from(array('account@mail.com' => 'Test'));
$email->to('me@gmail.com');
$email->subject('Test subject');
$email->send('Dummy post');
}
I think my code is OK (alltough I did not try it out, since gmail is restricted in our office, so I could not try it with my gmail settings). After clicking on the link ($this->Html->link('link', array('controller'=>'users', 'action'=>'send_mail'));) nothing happens (site refreshes) I do not get any errors whatsoever, not even in the tmp/error.log
I guess my port is not correct. (but any other reason, that would occur to you, will be appreciated)
After some digging I found the host to where I need to send this, my question is this:
How do I find the port my mailing service (Outlook 2007) is using to send messages?
What I tried:
http://www.authsmtp.com/outlook-2007/alternate-port.html , but all dialogs since image 2 vary from the pictures.
Also tried netstat -a in command line, but none of the two ports corresponding with my OUTLOOK worked.
Additional notes:
- I code this app on localhost (xampp -> apache)
- I added this "extension=php_openssl.dll" line to php.ini (it was proposed in some tutorial) and no change happened (still no error, still no mail)
UPDATE:
Changed the name of the function to "test_send_email" and now it does not refresh but after deleteng the auto render and adding a test_send_email.ctp view to my MVC this error is displayed:
SMTP timeout. Error: An Internal Error Has Occurred.
So I guess I am right and I do not have the correct port..
回答1:
The default port is 25, which was the case here.
You can check it with the cmd command telnet name_of_server 25
In outlook 2007 the server address can be found by right-clicking the message -> options -> down in the dialog box are the headers of this msg.
来源:https://stackoverflow.com/questions/14122508/determine-which-port-my-exchange-service-is-using-for-e-mail-sending-cakephp