I'm building my first Craft 3 site, and having problems getting email to send. I've set it to use Sendmail but when I click the Test button in the CP, I get "There was an error testing your email settings".

I know Sendmail isn't the best option but I need something for now until we get something more robust in place. My client doesn't yet have any email set up for this domain, but I assume Sendmail should still be able to create email?

I've tried using Sendmail from the command line and that seems to work fine. For each attempt to test from the control panel, I get this error in web.log:

2018-08-20 10:02:55 [][1][-][error][application] Error sending email: Expected response code 220 but got code "", with message ""

I'm on Craft 3.0.19. Any ideas what might be going wrong?


Most servers (speaking in generalities) won't send mail by themselves anymore. You'll need to use some sort of SMTP service.

Check out SendGrid to get you going. I believe they have a free plan. You can choose SMTP from the mail options from the settings page.

Choose 'Use Authentication' and from there your username is well, your username and your password is...your password. Use Port 587.

Hope this helps!

  • Thanks Damon, I'll check that out. The 100 email/day you get for free might even do the job for this one. Do you have experience of using Sendgrid for an email address that's hosted at Google Mail? I know that using SMTP from a server doesn't play very well with Google Mail, and you need to "allow less secure apps" etc. But I wonder if Sendgrid has a more reliable way round all that? – Frank Harrison Aug 30 '18 at 19:10
  • I've used SendGrid for quite a few projects and haven't had a problem with deliverability. When I did, it was usually my fault. :) – Damon Aug 31 '18 at 2:35
  • Where do you get this from "Most servers (speaking in generalities) won't send mail by themselves anymore." -> I have many servers, different providers, they all send email using PHP fine. I have never ever come across a server that for some reason wont send email using PHP. So not sure what this means. I agree use SMTP, but I find this an curious comment to make. The server i have now can send email fine, but I get this error above, so am looking for a fix to the issue, and not use SMTP. I have another issue with Craft and SMTP I need to see if PHP/Sendmail fixes. – Laurence Cope Sep 23 '19 at 12:30
  • Hi Laurence - thanks for the feedback. When you say, you have many servers from may providers who are they I'm generally curious. What I was trying to say is using the default php mail($to, $from) I've found generally doesn't work. I have had to use a mail provider such as SendGrid or MailGun – Damon Sep 24 '19 at 15:00

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.