Registration email not sending despite C5 mail object working perfectly

Permalink 2 2 Browser Info Environment
Can not get registration verification emails to send and dashboard email test fails despite the mail service working perfectly when tested.

Is at the very least a documentation 'bug' if not a genuine code one. Nobody on the forums knows why this is that I'm able to find, no-one has responded to posts for help so assuming it's a bug.

This below works perfectly and a mail arrives almost instantly but the dashboard test and the verification emails fail.

$mail = \Core::make('mail');
        $mail->setBody("Dear concrete5 team\nYour CMS is by far the best I\'ve ever seen.");
        $mail->addParameter('mailContent', $body);
        $mail->load('default', 'packagehandle'); // add any parameters before loading the template
        $mail->from($from, $from_name);

Status: New
View Best Answer
surefyre replied on at Permalink Reply
Even more bizarrely the send-email-to-admin-when-someone-registers email works fine so there's something screwy going on for sure.

Log says:
27 Sep 2017, 09:27:55 Sent Emails testah **EMAILS ARE ENABLED. THIS EMAIL HAS NOT BEEN SENT**
Template Used: validate_user_email
Mail Details: Date: Wed, 27 Sep 2017 09:27:55 +0000
From: [email protected]
Subject: NDA Registration - Validate Email Address
To: [email protected]
MIME-Version: 1.0
Content-Type: text/plain;
Content-Transfer-Encoding: 8bit

You must click the following URL in order to activate your account for NDA:

Thanks for your interest in NDA

and an error next to that log entry says:
27 Sep 2017, 09:27:55 Exceptions testah Mail Exception Occurred. Unable to send mail: Unable to send mail: Unknown error
#0 [internal function]: Zend\Mail\Transport\Sendmail->mailHandler('[email protected]', 'NDA R...', 'You must click ...', 'Date: Wed, 27 S...', ' -fconcrete5-no...')
#1 /var/www/ call_user_func(Array, '[email protected]', 'NDA R...', 'You must click ...', 'Date: Wed, 27 S...', ' -fconcrete5-no...')
#2 /var/www/ Zend\Mail\Transport\Sendmail->send(Object(Zend\Mail\Message))
#3 /var/www/ Concrete\Core\Mail\Service->sendMail()
#4 /var/www/ Concrete\Core\User\StatusService->sendEmailValidation(Object(Concrete\Core\User\UserInfo))
#5 [internal function]: Concrete\Controller\SinglePage\Register->do_register()
#6 /var/www/ call_user_func_array(Array, Array)
#7 /var/www/ Concrete\Core\Controller\AbstractController->runAction('do_register', Array)
#8 /var/www/ Concrete\Core\Http\ResponseFactory->controller(Object(Concrete\Controller\SinglePage\Register))
#9 /var/www/ Concrete\Core\Http\ResponseFactory->collection(Object(Concrete\Core\Page\Page))
#10 /var/www/ Concrete\Core\Routing\DispatcherRouteCallback->execute(Object(Concrete\Core\Http\Request))
#11 /var/www/ Concrete\Core\Http\DefaultDispatcher->handleDispatch(Object(Concrete\Core\Http\Request))
#12 /var/www/ Concrete\Core\Http\DefaultDispatcher->dispatch(Object(Concrete\Core\Http\Request))
#13 /var/www/ Concrete\Core\Http\Middleware\DispatcherDelegate->next(Object(Concrete\Core\Http\Request))
#14 /var/www/ Concrete\Core\Http\Middleware\ThumbnailMiddleware->process(Object(Concrete\Core\Http\Request), Object(Concrete\Core\Http\Middleware\DispatcherDelegate))
#15 /var/www/ Concrete\Core\Http\Middleware\MiddlewareDelegate->next(Object(Concrete\Core\Http\Request))
#16 /var/www/ Concrete\Core\Http\Middleware\FrameOptionsMiddleware->process(Object(Concrete\Core\Http\Request), Object(Concrete\Core\Http\Middleware\MiddlewareDelegate))
#17 /var/www/ Concrete\Core\Http\Middleware\MiddlewareDelegate->next(Object(Concrete\Core\Http\Request))
#18 /var/www/ Concrete\Core\Http\Middleware\CookieMiddleware->process(Object(Concrete\Core\Http\Request), Object(Concrete\Core\Http\Middleware\MiddlewareDelegate))
#19 /var/www/ Concrete\Core\Http\Middleware\MiddlewareDelegate->next(Object(Concrete\Core\Http\Request))
#20 /var/www/ Concrete\Core\Http\Middleware\ApplicationMiddleware->process(Object(Concrete\Core\Http\Request), Object(Concrete\Core\Http\Middleware\MiddlewareDelegate))
#21 /var/www/ Concrete\Core\Http\Middleware\MiddlewareDelegate->next(Object(Concrete\Core\Http\Request))
#22 /var/www/ Concrete\Core\Http\Middleware\MiddlewareStack->process(Object(Concrete\Core\Http\Request))
#23 /var/www/ Concrete\Core\Http\DefaultServer->handleRequest(Object(Concrete\Core\Http\Request))
#24 /var/www/ Concrete\Core\Foundation\Runtime\Run\DefaultRunner->run()
#25 /var/www/ Concrete\Core\Foundation\Runtime\DefaultRuntime->run()
#26 /var/www/ require('/var/www/')
#27 {main}
Template Used: validate_user_email
To: [email protected]
From: [email protected]
Subject: NDA Registration - Validate Email Address

You must click the following URL in order to activate your account for NDA:

Thanks for your interest in NDA
surefyre replied on at Best Answer Permalink Reply
I believe I found the root of the issue

In my installation, for whatever reason - and this is both dev and live which were both setup as standard C5 installs from 8.2.1 individually - the validation email from and fromname are null and this causes the validation registration email to screw up.

I put this in my package controller to explicitly set the values in C5
        // Fix validation email address info cos C5 team forgot to put it in?
        \Config::save('', '[email protected]');
        \Config::save('', 'The One Group');

Now it works. I really hope this helps folks with the same issue. Will add it to my bug report.

Now just don't tell the client I spent about a day in total finding this fix...

concrete5 Environment Information

# concrete5 Version
Core Version - 8.2.1
Version Installed - 8.2.1
Database Version - 20170802000000

# concrete5 Packages
The One Group (0.9.53)

# concrete5 Overrides

# concrete5 Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache/2.4.18 (Ubuntu)

# Server API

# PHP Version

# PHP Extensions
apache2handler, calendar, Core, ctype, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, json, libsodium, libxml, mbstring, mysqli, mysqlnd, openssl, pcre, PDO, pdo_dblib, pdo_mysql, Phar, posix, readline, Reflection, session, shmop, SimpleXML, sockets, SPL, standard, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, Zend OPcache, zip, zlib

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 128M
post_max_size - 8M
sql.safe_mode - Off
upload_max_filesize - 2M
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
opcache.max_accelerated_files - 2000
opcache.max_file_size - 0
opcache.max_wasted_percentage - 5

Browser User-Agent String

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.90 Safari/537.36