@andrew , I’ve just removed everything and simply pasted 3 strings:
and here’s the log:
As you can see:
the To is ok
the From is NOT, it doesn’t have the email and the same in the headers
AND I did not receive any email.
As you can see in my 3rd post above, if you pass a string to the ‘from’ method, it won’t work because $fromStr = $this->generateEmailStrings([$this->from]); works only on an array of arrays, not on a simple array which is passed to it from the ‘from’ method.
Maybe the To field is in form "Name" <address>, but the way concrete displays it strips the stuff between angular parenthesis.
To be sure about that, you can check the value stored in the logs table
Exception Occurred: /srv/www/htdocs/c9/concrete/vendor/laminas/laminas-mail/src/Address.php:72 The input is not a valid email address. Use the basic format local-part@hostname (0)
BTW, I’m using Default PHP Mail Function, not SMTP
I also see that some sort of template is used. I don’t create any, it’s coming from the system. Can that be the problem?
Yes, just done it a number of times with different emails.
If I remove the name string from the ‘from’, i.e. $mh->from(‘email@gmail.com’); then at least the header has the email address. Could that be an error with the providers that if there’s no from address they think it’s spam and simply delete it right away?
As I wrote above, you may not see the email address in the Logs dashboard page if you use both the name and the email address.
As I wrote above, if the To header has this value:
To: John <john@doe.com>
When you view the log entry, the part between < and > may be hidden, but it’s still there (it’s simply not displayed in the Logs page).
That’s why you should check directly in the Logs database table.
If you use the mail() PHP function, Concrete doesn’t have a way to see if the email has been sent by it.
If you want to use mail(), you have to configure a mail sending service in your web server (google for sendmail ).
People usually use an external SMTP service, which is much easier to be configured.
There’s not alternative: you have to use an external SMTP service, or you have to configure PHP and sendmail on your web server.
BTW, 5-10 secs is very slow, you should consider other SMTP services (sadly it’s very hard to find a free SMTP service provider).