SID-02308: Cannot send email with SMTP
| Status: |
Answered |
TWiki version: |
6.0.2 |
Perl version: |
v5.10.1 |
| Category: |
CategoryEmail |
Server OS: |
CentOS 7 |
Last update: |
8 years ago |
I have configure my twiki using SMTP for EMail. But it is failed to send email.
Following message is shown when I want to reset my password.
TWiki.ERROR: Can't send mail using Net::SMTP. Can't connect to 'smtp.mysite.com' at /var/www/twiki/lib/TWiki/Net.pm line 665. %PARAM2% %PARAM3% %PARAM4%
But I am sure that I can ping this smtp server successfully.
My Configure setting is:
{EnableEmail} true
{WebMasterEmail} wikimaster@mysite.com
{WebMasterName} XXXXXXXX
{MailProgram} /usr/sbin/sendmail -t -oi -oeq // default value
{SMTP}{MAILHOST} smtp.mysite.com
{SMTP}{Username} wikimaster@mysite.com
{SMTP}{Password} mypassword
all other fields about email are blanks.
Can you help to find something reasons ? Thanks.
--
Tony Lu - 2017-03-19
Discussion and Answer
You can get more information by configuring your TWiki with the expert option
{SMTP}{Debug}. This usually helps a lot to get the exact reason why sending mail fails.
So far, I have just one guess:Your
{SMTP}{Username} should be your mysite account and not your mail address - maybe just omit the
@mysite.com?
--
Harald Jörg - 2017-03-19
Or, possibly your mail server requires TLS? See
SMTPUseTLS
Also, if the smtp server is company internal you likely do not need to authenticate to send e-mail, e.g. empty
{SMTP}{Username} and
{SMTP}{Password}
--
Peter Thoeny - 2017-03-19
Finally, I got the reason about it. It should be configured to allow connect network and send email by execute command:
setsebool httpd_can_sendmail=1
setsebool httpd_can_network_connect=1
--
Tony Lu - 2017-03-20
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
Topic revision: r4 - 2017-03-20
- TonyLu