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

<p>Check out <a href="https://sendgrid.com/" rel="nofollow noreferrer">SendGrid</a> to get you going. I believe they have a free plan. You can choose <code>SMTP</code> from the mail options from the settings page.</p>

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

<p>Hope this helps!</p>

CC BY-SA 4.0
2018-08-30T19:10:22.110Z
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
CC BY-SA 4.0
2018-08-31T02:35:04.647Z
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
CC BY-SA 4.0
2019-09-23T12:30:28.637Z
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
CC BY-SA 4.0
2019-09-24T15:00:13.583Z
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
CC BY-SA 4.0
2018-08-30T17:17:54.953Z
2018-08-30T17:17:54.953Z
Damon
<p>Shameless plug: We have published a <a href="https://blog.fortrabbit.com/three-ways-to-reset-the-craft-cms-control-panel-password-without-email-access" rel="nofollow noreferrer">blog post</a> highlighting three ways to recover an account password for Craft CMS, specifically when sendmail is disabled (like with our service as well).</p>
<p>Like mentioned by Damon above, setting up a transactional mail provider is easy. There are plugins. Many are providing a free tier.</p>
<p>If you only want to reset a forgotten account password you can also resort to the craft console, login by SSH on the server and then run:
<code>php craft users/set-password &lt;username&gt; &lt;newpassword&gt;</code>. That works without enabling mailing first.</p>

CC BY-SA 4.0
2024-10-17T07:34:44.387Z
2024-10-17T07:34:44.387Z
Frank Lämmer
<blockquote>
  <p>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.</p>
</blockquote>

<p>I agree. Tough a SMTP Service most of the time IS the better choice, I have projects that simply don't need the Involvement of yet another service. If you happen to have a lot of small clients, that need Craft to send Password Reset Mails and maybe a Contact Form – I go for Sendmail. While this answer is (eventaually) not the solution to the Error of this question, I want to help people that come along here and want to get their Sendmail to work.</p>

<p><strong>Here's some things that might help</strong> you to get Sendmail working on your Hosting Provider.</p>

<ul>
<li>On shared hosting platforms you might want to make sure, that the E-Mail – you use as sender – exists in the Hosting Package (I have one Hoster that does that)</li>
<li>Make sure the sendmail path is correct (search for it in the Webspace) – it might not always be /usr/sbin/sendmail)</li>
<li>Experiment with the sendmail command. A setup that works with most Hosting Providers is <code>/usr/sbin/sendmail -t -f mail@domain.de</code>, where you replace mail@domain.de with the actual address you're sending from (additionally to the sender Address in the Craft Backend.</li>
<li>Read the Documentation of your Hosting Provider, oftentimes they tell you what flags need to be present for it to work.</li>
</ul>

<p>Hope that helps.</p>

CC BY-SA 4.0
2020-04-09T10:37:46.703Z
2020-04-09T10:37:46.703Z
Max Strebel
<p>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".</p>

<p>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?</p>

<p>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:</p>

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

<p>I'm on Craft 3.0.19. Any ideas what might be going wrong?</p>

<craft3><emails>
Sendmail not working on Craft 3
# Sendmail not working on Craft 3

(Asked by: username_0 on 2018-08-20)

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 [86.167.235.31][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?

**Tags:** craft3, emails

---

## 3 answers

### Answer by username_1 on 2018-08-30. Score: 3

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](https://sendgrid.com/) 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!

> **Comments:**
> **username_0**: 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?  
> **username_1**: 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. :)  
> **username_2**: 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.  
> **username_1**: 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  

---

### Answer by username_3 on 2024-10-17. Score: 1

Shameless plug: We have published a [blog post](https://blog.fortrabbit.com/three-ways-to-reset-the-craft-cms-control-panel-password-without-email-access) highlighting three ways to recover an account password for Craft CMS, specifically when sendmail is disabled (like with our service as well).

Like mentioned by Damon above, setting up a transactional mail provider is easy. There are plugins. Many are providing a free tier.

If you only want to reset a forgotten account password you can also resort to the craft console, login by SSH on the server and then run:
`php craft users/set-password` . That works without enabling mailing first.


---

### Answer by username_4 on 2020-04-09. Score: 1

> 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.

I agree. Tough a SMTP Service most of the time IS the better choice, I have projects that simply don't need the Involvement of yet another service. If you happen to have a lot of small clients, that need Craft to send Password Reset Mails and maybe a Contact Form – I go for Sendmail. While this answer is (eventaually) not the solution to the Error of this question, I want to help people that come along here and want to get their Sendmail to work.

**Here's some things that might help** you to get Sendmail working on your Hosting Provider.

* On shared hosting platforms you might want to make sure, that the E-Mail – you use as sender – exists in the Hosting Package (I have one Hoster that does that)
* Make sure the sendmail path is correct (search for it in the Webspace) – it might not always be /usr/sbin/sendmail)
* Experiment with the sendmail command. A setup that works with most Hosting Providers is `/usr/sbin/sendmail -t -f mail@domain.de`, where you replace mail@domain.de with the actual address you're sending from (additionally to the sender Address in the Craft Backend.
* Read the Documentation of your Hosting Provider, oftentimes they tell you what flags need to be present for it to work.

Hope that helps.


---

