2

I have trouble sending emails with Joomla! 3.6.5 I get a message Notice ??SMTP connect failed??

The settings in the configuration file are the same as the same ones as at the hosted website.

public $sendmail = '/usr/sbin/sendmail';
public $smtpauth = '0';
public $smtpuser = '';
public $smtppass = '';
public $smtphost = 'localhost';
public $smtpsecure = 'none';
public $smtpport = '25';

Any guesses?

  • 1
    When you say "localhost", do you mean you are running it on your local PC instead of the web server? – Michael Yaeger Jan 3 '17 at 14:02
  • Yes I do. I saw FFrewin's answer but I will do this ones the page is live on the web server. – Henry Lynx Jan 3 '17 at 14:05
3

You need a valid smtp server account in order to be able to send emails through SMTP.

Your configuration settings show:

SMTP Host = localhost
SMTP User = ''; // none, empty
SMTP Password = ''; //none, empty

Since I see localhost for the host, I assume you want to use the smtp server of our hosting account. In this case you need to ask your hosting provider about the SMTP host, credentials, info and adjust your configuration file accordingly.

1

Option 1:

In order for you to use the SMTP option in Joomla! on your local installation, you will need an SMTP service installed on that PC listening to port 25 (or whatever port you assign).

If you do not have an SMTP service running on your PC (which you likely do not), you can change:

public $mailer = 'smtp';

To:

public $mailer = 'mail';

This will set your Joomla! installation to use the PHP mailer (which you already have if you're running Joomla! locally). You can leave all of your other SMTP settings intact as they will not be used. Once you are ready to push the site to the web server, you can change mail back to smtp.


Option 2:

If you need to test SMTP functionality while running the J! site locally, you will need to obtain the IP address of the web server running your SMTP service. So, if your web server's IP address is 55.55.55.55, then you would change:

public $smtphost = 'localhost';

To:

public $smtphost = '55.55.55.55';

This will ensure that your PC is talking to the mail/web server instead of your local PC when it comes time to send messages. These same settings will work no matter the location of your J! site as the site will always be talking to the same server.


WARNING:

If the settings in your post work for ANY server, then I would abandon that server immediately! Since it does not require authorization to send (public $smtpauth = '0';), anyone with the IP address of your server will be able to send unlimited numbers of SPAM messages. If this is actually the case, moving to an SMTP service like Amazon SES may be your best bet (they have a large free tier).

1

I also noticed your password and username were empty in the configurations you posted: essentially, you do not actually have SMTP and as Michael's warning states, your previous host was actually just allowing you to send without any authorization and creating a security vulnerability.

A host will have documentation on their SMTP requirements and settings. Your localhost is a little more up in the air, and may not even allow for the PHP mail settings.

Answer: Sign up for an SMTP Service and use those credentials

We use SendGrid for this due to the high volume of sites we maintain. However, there's a free version for single accounts (it is called Trial, but it is not limited by time, only by number of emails), and they have plenty of documentation. The default settings, that should work for your Joomla install on a localhost are as follows:

Change your SMTP username and password to your SendGrid credentials, set the server host name to smtp.sendgrid.net, use ports 25 or 587 for plain/TLS connections and port 465 for SSL connections

I've found that on Joomla 3.0.0 - 3.4.x that 465 SSL was the best solution, but 3.5.x and up needed port 587 and a plain connection. Of course that was all subject to the host, but a good host will have documentation to help you find the right settings.

I can't recommend them enough. We've gone up and down and around the bend on SMTP for Joomla and Wordpress, and SendGrid is the customizable solution that can fit any situation.

  • It appears that the Free plan has been replaced with a Free Trial: sendgrid.com/free – Michael Yaeger Jan 4 '17 at 18:21
  • Also, you must check out the new "big hitter" in the SMTP game...Amazon SES! – Michael Yaeger Jan 4 '17 at 18:23
  • They call it Free Trial, but it actually is a Free Plan. They want to grow you from the free account into a paid account, but most people don't send 40000 emails a day. Thanks for the Amazon referral, I will check it out! – Faye Jan 4 '17 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.