sendmail: Error using sendmail

I am building an application that needs to send an alert to an email address when a value is exceeded. So I am trying to debug sendmail and am using the following code.
setpref('Internet','SMTP_Server', 'mydomain.com')
setpref('Internet','E_mail', 'me@mydomain.com')
setpref('Internet','SMTP_Username','me@mydomain.com')
setpref('Internet','SMTP_Password','password')
sendmail('recipientsemail@theirdomain.org','RADAR Test','Test message')
However, I get the following message:
Error using sendmail (line 171)
Could not connect to SMTP host: mydomain.com, port: 25;
Connection refused: connect
Error in tryEmail (line 12)
sendmail('recipientsemail@theirdomain.org','RADAR Test','Test message')
Of course the emails and passwords are actual working values in my real code. The mydomain is my own email account I own with a 3rd party hosting provider. I'd be grateful for any hints.
Thanks, Jeff

回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 2 月 28 日
編集済み: Azzi Abdelmalek 2014 年 2 月 28 日

0 投票

This line setpref('Internet','SMTP_Server', 'mydomain.com') should be
setpref('Internet','SMTP_Server', 'smtp.mydomain.com')

1 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 2 月 28 日
編集済み: Azzi Abdelmalek 2014 年 2 月 28 日
have you tried?
setpref('Internet','SMTP_Server','mail');

サインインしてコメントする。

Jeff
Jeff 2014 年 2 月 28 日

0 投票

Thanks, Azzi. I've tried that as well. For my settings, I believe it should actually be mail.mydomain.com. At least that is what my host company specified.

タグ

質問済み:

2014 年 2 月 28 日

編集済み:

2014 年 2 月 28 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by