Magento2: Magento 2.3 mail send issue

Created on 1 Jan 2019  路  80Comments  路  Source: magento/magento2

Preconditions

  1. Magento 2.3.1 or 2.2.8

Steps to reproduce

  1. Sales > Orders > Open any one order.
  2. Click on Send mail.
  3. Register new customer.

    Expected result

  4. Mail should be send

Actual result

  1. main.ERROR: Unable to send mail: Unknown error

Same env works for every mail like register, new order and any other with 2.2.7 or 2.3.0

Format is valid

Most helpful comment

If Magento 2.3.2 is a fresh install, it could be with the server missing the sendmail:

check first if php mail is installed:
php -r "mail('[email protected]', 'Is PHP Mail Setup', 'Yes - I got this email');"
if you get this message:
sh: 1: /usr/sbin/sendmail: not found

then install:
sudo apt-get install sendmail

run this again:
php -r "mail('[email protected]', 'Is PHP Mail Setup', 'Yes - I got this email');"

if it is blank then it should work now.

Try to send from the contact form to see if it works.

All 80 comments

Hi @visahardik. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me $VERSION instance

where $VERSION is version tags (starting from 2.2.0+) or develop branches (for example: 2.3-develop).
For more details, please, review the Magento Contributor Assistant documentation.

@visahardik do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

@visahardik are you using XAMPP with Linux or MacOS?

You need to debug further what is going wrong on your env, otherwise such issue looks pretty hard to reproduce and investigate by others.

@visahardik are you using XAMPP with Linux or MacOS?

You need to debug further what is going wrong on your env, otherwise such issue looks pretty hard to reproduce and investigate by others.

I am using XAMPP with Windows 10. I tried to debug but does not give proper error TranString return files path but not give error.

Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 6. Add label Issue: Confirmed once verification is complete.

  • [ ] 7. Make sure that automatic system confirms that report has been added to the backlog.

HI @visahardik thank you for you report, i'm not able to reproduce following steps you described.
This is not a valid environment, please check https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html

Hi All,
I am also facing same issue, mail functionality is not working, so i tried debug but cannot able to get respective error expect the following return message.

{"result":false,"message":"Error sending email. We can't process your request right now.","data":"Unable to send mail: Unknown error"}

Before 2.3 upgrade everything was working fine, but after upgrade only got issue because latest version had updates on Transport.php file, ....please try to help someone. Thanks in advance.

Same issue using docker

Same issue here, order and invoice emails are not sent anymore after the 2.2.8 and 2.3.1 upgrade.

@rvinothraj @itsazzad @pixmin this cannot be investigated without a proper debug on your side. Set a breakpoint at line where error is thrown to see what is causing an issue.

Is it correct that you're not using XAMPP?

@orlangur Correct, not using XAMPP (on Debian / Apache)

I have no error message for the order / invoice process, but I'm now going to check if I can reproduce and get more information with the problems reported by @visahardik

@orlangur Sorry but when trying to reproduce, I get no error:

On Magento 2.3.1, go in the back office: Sales > Orders and open an order
Click on "Send email", confirm
I do get the message "You sent the order email." but receive nothing and have no errors in any logs I can think of (console log from the browser, no error in any of the AJAX calls, nothing in any of the log files in var/log, and no error in the Apache logs).

If I switch to 2.3.0 on the very same environment, I get the email...

Would love to help debug this issue, but how?

Note: The issue is exactly the same with Magento 2.2.x (works in 2.2.7 and stopped working on 2.2.8)

@pixmin,

Set a breakpoint at line where error is thrown to see what is causing an issue.

Please try this. And then check stack trace in runtime to see what is an underlying error.

@orlangur As I said, I have absolutely no error, at least nowhere I am looking: Browser console and network tab, Apache logs, Magento logs (all log files in var/log: system and debug log files).

@pixmin it's not about any error in logs. Set xdebug breakpoint at line where such exception is thrown and check stack trace and variable values before it is thrown.

@orlangur

Set xdebug breakpoint at line where such exception is thrown

I have no exception thrown... none.

@pixmin you need to find a place in code where Error sending email. We can't process your request right now. message is created and set breakpoint there.

Usually this is some exception throwning.

@orlangur Sorry, I might need to create a new issue as I am not having this error. I have absolutely no error anywhere. No indication that there is a problem with email sending except for the fact that I do not receive them...

@pixmin did you have installed 3rd party extension ?

@engcom-backlog-nazar None, it's a fresh install (on both 2.2.8 and 2.3.1)

@pixmin ok, so this instance installed on local environment or cloud ?

@engcom-backlog-nazar local environment I'm afraid.

But (just in case you missed that part), when I install a 2.2.7 or 2.3.0 on the very same environment, emails just work... I haven't gone through the process of diff'ing both versions to check if anything email-related changed...

@pixmin can you try send email by php -r "mail('[email protected]','theme','body');"

@engcom-backlog-nazar One of the first thing I tried, email goes through instantly... And emails also go through just fine on the same server with both 2.2.7 and 2.3.0...

Thanks for helping me debugging it!

@pixmin all instances installed via docker ?

@engcom-backlog-nazar No, manual install (tried both via "magento setup:install" and via the browser). I just download the archive from Magento's website, extract and install...

@pixmin ok, i'm reproduce this on 2.3.1 but not on 2.3-dev strange.

@engcom-backlog-nazar Fantastic! Looking forward to find out what's the issue...

Any update on this?
It has been reproduced a week ago.

@engcom-backlog-nazar could you please mark it as ready for work or something.

@pixmin, the issue has been revised and retested. We confirm it is already fixed in 2.3-develop branch and will be available in 2.3.2 release. Thank You.

OK, thanks @AlexWorking

It's not tagged for "2.3.2" or something in Github.
Is there a planned release date that can be communicated to complaining users?

@MarcusWolschon Google thinks he knows the answer :) https://www.google.com/search?q=when+magento+2.3.2+release

I doubt there is an exact date, probably there will be some announcement on Imagine May 13-15. Previous year it was announced that general approach is having a release each quarter which is more or less true for 2.3.0 and 2.3.1 so far. Then, according to my understanding, end of Q2 2019 or beginning of Q3 2019 is a fair approximation, but again, I heard nothing official on this.

Probably makes sense to find a patch out of 2.3-develop in your case.

is there any patch to make this work on Magento 2.3.1?

@pixmin , el problema ha sido revisado y vuelto a probar. Confirmamos que ya est谩 solucionado en la rama 2.3-develop y estar谩 disponible en la versi贸n 2.3.2. Gracias.

I have the same problem, could you tell me how to solve it in my environment? To avoid having to wait for version 2.3.2

@engcom-backlog-nazar One of the first thing I tried, the email goes through instantly... And emails also go through just fine on the same server with both 2.2.7 and 2.3.0...

Thanks for helping me debugging it!

Can you please tell me the solution for this? I am also working on Magento2.3.1. Emails are not receiving to the customer.

Customers are complaining since 2 weeks and there's nothing my client (the shop) can tell them.

@pixmin, the issue has been revised and retested. We confirm it is already fixed in 2.3-develop branch and will be available in 2.3.2 release. Thank You.

So Could you please help me on this for magento2.3.1?

@pixmin, the issue has been revised and retested. We confirm it is already fixed in 2.3-develop branch and will be available in 2.3.2 release. Thank You.

This issue number (#20033) has not been mentioned in the commit. Else there would be an automatic link here and people could patch their own installations instead of waiting for 2.3.2 and asking questions.

@pixmin, the issue has been revised and retested. We confirm it is already fixed in 2.3-develop branch and will be available in 2.3.2 release. Thank You.

This issue number (#20033) has not been mentioned in the commit. Else there would be an automatic link here and people could patch their own installations instead of waiting for 2.3.2 and asking questions.

So, how do we solve this problem?

@ManuIB somebody needs to find in 2.3-develop commits which fixed the problem first.

@ManuIB somebody needs to find in 2.3-develop commits which fixed the problem first.

I never did this before, could you tell me how to do it please? This can break my website?

@ManuIB git bisect should be an easiest option or check history of files which should potentially contain such kind of fix.

I checked the latest commits but since I don't know the codebase of Magento internal very well, I was unable to find anything related to this.

Any update on this issue ?

@nikhil91100 Whats the php version on the install? I made it working as i degraded the php version to 7.1

@nikhil91100 Whats the php version on the install? I made it working as i degraded the php version to 7.1

PHP 7.2.17,
magento 2.3.1

on debugging i can see the this on log main.CRITICAL: Deprecated Functionality: idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated in /public_html/vendor/zendframework/zend-validator/src/EmailAddress.php on line 560

if (extension_loaded('intl')) {
if (defined('INTL_IDNA_VARIANT_UTS46')) {
return (idn_to_ascii($email, 0, INTL_IDNA_VARIANT_UTS46) ?: $email);
}
return (idn_to_ascii($email) ?: $email);
}

so basically its checks for INTL_IDNA_VARIANT_UTS46 on that code and in my case its not there INTL_IDNA_VARIANT_2003 is depreciated in PHP 7.2

INTL_IDNA_VARIANT_2003 (integer) Use IDNA 2003 algorithm in idn_to_utf8() and idn_to_ascii(). This is the default. This constant and using the default has been deprecated as of PHP 7.2.0.

INTL_IDNA_VARIANT_UTS46 (integer) Use UTS #46 algorithm in idn_to_utf8() and idn_to_ascii(). Available as of ICU 4.6.

Either you need ICU 4.6 installed or degrade php to 7.1

@navaneeth008 ,
i installed ICU ,
$ sudo apt install icu-devtools
$ uconv -V
uconv v2.1 ICU 64.1
But still not receiving any mail . ( Not even contact us mail and there is no error too ) .

@nikhil91100 Try forgot password and let me know what error message are you getting?

@navaneeth008
tried forgot password and its successful ( If there is an account associated with [email protected] you will receive an email with a link to reset your password.) but no mail received.

@nikhil91100 can you try sending mail from server and check if that's sent?

@navaneeth008 done using mail() function and its successful but no mail received .

@nikhil91100 so its an issue with server not magento, please check with server support team

@navaneeth008 ok

I have the same problem. Have someone this magical commit what repair this issue? Where I can find the solution for it before next release?

Whats the best way to disable the contact form and replace it with an email address?
People are complaining for 2 weeks about the non-working contact form now and rightfully so.

Ok, I had really stupid mistake. For extra bcc email addresses, what I want to add to each email, I set emails separete by semicolon, not comma (that is mistake). This situation has no error information. And after all the SenderBuilder can't read it properly, and don't send anything. I think that should be protect somehow agaist this situation. Becuase email with order can't go to clients. If it not go to my extra email it's not a problem, but if client can't recaive order it is. And as usually, the configuration can do some people from ecommerce, not from IT, they can do that mistake and not record it.

Any update ?

Same issue in 2.3.1, any update in 2.3.2? could you provide some patch?

@nikhil91100 @winds1983 what do you mean? Issue is fixed in to-be-released 2.3.2 and 2.3-develop.

@orlangur ok , thanks

@orlangur Thank, I know you have already fix it on 2.3.2, could you send us patch or some fixed file? And when will release 2.3.2?

@winds1983 it was fixed without link to this issue, so, exact patch should be found by somebody.

I don't know dates for 2.3.2, it is already tested internally for some time (new contributions currently target 2.3.3 already).

2.3.2 is too late. Customers are complaining now. Not in 2 month.
So we need to patch our productive shops with the fix or at the very least have
something we can answer to the complaining customers.

For the people trying to find out the release date of Magento 2.3.2, it was mentioned on Slack in a public channel by 2 different Magento employees, one said it would be around 26th of June and the other said it would be in the middle of June. So it's not a hard date, but it should be around that period.
And you can always guess, there is a 3 month release schedule, the last release was on the 26th of March. So add 3 months, and voil脿 :)

@orlangur Ok, thanks.

@MarcusWolschon,

So we need to patch our productive shops with the fix

If it's true, somebody please find an exact patch and post it here.

I have the same problem. Where can I find the patch?

2.3.2 is released.
While it may or may not have solved the email issue for order emails,
the broken contact-form still does not work.
(Will look if a ticket for that already exits)

If Magento 2.3.2 is a fresh install, it could be with the server missing the sendmail:

check first if php mail is installed:
php -r "mail('[email protected]', 'Is PHP Mail Setup', 'Yes - I got this email');"
if you get this message:
sh: 1: /usr/sbin/sendmail: not found

then install:
sudo apt-get install sendmail

run this again:
php -r "mail('[email protected]', 'Is PHP Mail Setup', 'Yes - I got this email');"

if it is blank then it should work now.

Try to send from the contact form to see if it works.

2.3.2 here

  • order status emails working
  • contact form NOT working
  • php mail() command working fine
  • sendmail (of the courier-mta family) is present

Email stops working after upgrade to 2.3.2
Magento version: 2.3.2
magento2-mandrill: 3.3.16

I created #23645 for the remaining issue with the contact form.

I found it might be the issue of the $parameters of PHP-Mail /vendor/zendframework/zend-mail/src/Transport/Sendmail.php - line 305: $result = mail($to, $subject, $message, $headers, $parameters); When debugging the $parameters that shows: '-f'[email protected]' then it will not send any email out. But if it changed to '-f [email protected]' then I can receive the email.

I found it might be the issue of the $parameters of PHP-Mail /vendor/zendframework/zend-mail/src/Transport/Sendmail.php - line 305: $result = mail($to, $subject, $message, $headers, $parameters); When debugging the $parameters that shows: '-f'[email protected]' then it will not send any email out. But if it changed to '-f [email protected]' then I can receive the email.

We had a look and experienced the same issue.
However even with the correct -f parameter it would still fail without any error message.
We are using the Courier Mail Server to provide our sendmail implementation.
Using the PHP mail() function with and without a parameters="-f ..." works fine on the command line as the php-user and using the same PHP version and php.ini file as the web browser.

This may help people with who has the same env with my site:

We got this issue after upgrade to 2.3. We are running in AWS and sending email vis SES.
The email was not going and there was no error showing in any log files. The mail log also not showing any entry. We tried with a test script and found that mail is sending successfully with 4 arguments in mail().

But on trying with 5 argument('[email protected]'), we got below error in console.
[root@ip-111-22-3-444 current]# php /tmp/t.php
More than one "from" person

Thus we debugged the files and found that the 5th argument is the cause for this issue.
/vendor/zendframework/zend-mail/src/Transport/Sendmail.php - line 305

Earlier magento versions was using zendframework1 and the mail function was having only 4 arguments. Thus email is failing when trying to sent it via providers such as SES. To fix this we had added below entry in sendmail configuration in ini files.
sendmail_path = "/usr/sbin/sendmail -t -i -f [email protected]"

In magento 2.3 new zendframework is using and mail function is having 5 arguments. In this version they have fixed the issue by adding '[email protected]' as the 5th argument. This is creating conflict with the fix added in ini files.

By removing the entries in ini files, now email started working from 2.3 instance.

@manucorra solution worked for me... thanks

If sendmail isn't installed, install it: sudo apt-get install sendmail
Configure /etc/hosts file: nano /etc/hosts
Make sure the line looks like this: 127.0.0.1 localhost yourhostname
Run Sendmail's config and answer 'Y' to everything: sudo sendmailconfig
Restart apache sudo service apache2 restart

Was this page helpful?
0 / 5 - 0 ratings