Problem with Registration Email

Author Message

Marko Žmak

Tuesday 22 November 2005 5:42:53 am

I have setup user registration on my eZ site, everything works OK except that in emails notices about user registrations that come to the admin email, the sender is "www-data". Where do I set this sende? This is how my eZ config looks like:

[UserSettings]
RegistrationEmail=myemail@myemail.com
UserClassID=53
LogoutRedirect=/content/view/full/2

[MailSettings]
AdminEmail=myemail@myemail.com
EmailSender=myemail@myemail.com

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Marko Žmak

Wednesday 23 November 2005 2:11:59 pm

Does anyone know an answer to this?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Nathan Kelly

Wednesday 23 November 2005 3:23:16 pm

Hi Marko, do you have your siteURL set in your site ini?

[SiteSettings]
SiteName=mysite
SiteURL=???

I'm not sure if that makes a difference?

I have a similar issue, my registration emails all come through with the sender as the site name, whereas my contact forms come through with the sender as the EmailSender set in the site ini.

[MailSettings]
Transport=sendmail
AdminEmail=admin@site.com.au
EmailSender=company@site.com.au

Also my admin receives an email from: "Nobody www.site.com.au", How do I change "Nobody" to what I want, where does the word Nobody come from?

Cheers!

Pardon me while I burst into flames...

Marko Žmak

Thursday 24 November 2005 2:11:49 pm

This last problem that you described (the mail that admin gets) is my problem too. "Nobody" in your case (and "www-data" in my case) comes from the mail sender program that PHP uses, it depens on the configuration of your server.

This happens when an email is sent without "Sender" specified, the mail program automatically puts something like this. This probably means that eZ dosen't set the Sender when sending this emails to the admin, but I would like to know if eZ can be configured in a way that it sets the Sender.

Can anyone give an answer to this?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Nathan Kelly

Thursday 24 November 2005 3:02:23 pm

Well I spent most of yesterday and this morning trying to figure this out but nothing I do seems to work.

Surely someone has some idea how this "email sender" can be set?

Pardon me while I burst into flames...

Nathan Kelly

Thursday 24 November 2005 3:20:04 pm

When in doupt, get dirty and hack the kernel:

I got it working, the problem is that the /kernel/user/register.php doesn't allow for a sender in the registrationfeedback, so I just hacked it to include a sender and it worked.

Look in /kernel/user/register.php and replace the block of code below:

$feedbackTypes = $ini->variableArray( 'UserSettings', 'RegistrationFeedback' );
            foreach ( $feedbackTypes as $feedbackType )
            {
                switch ( $feedbackType )
                {
                    case 'email':
                    {
                        $mail = new eZMail();
                        $tpl->resetVariables();
                        $tpl->setVariable( 'user', $user );
                        $tpl->setVariable( 'object', $object );
                        $tpl->setVariable( 'hostname', $hostname );
                        $templateResult =& $tpl->fetch( 'design:user/registrationfeedback.tpl' );
                        $feedbackReceiver = $ini->variable( 'UserSettings', 'RegistrationEmail' );
                        if ( !$feedbackReceiver )
                            $feedbackReceiver = $ini->variable( "MailSettings", "AdminEmail" );

                        $subject = ezi18n( 'kernel/user/register', 'New user registered' );
                        if ( $tpl->hasVariable( 'subject' ) )
                            $subject =& $tpl->variable( 'subject' );
                        if ( $tpl->hasVariable( 'email_receiver' ) )
                            $feedbackReceiver =& $tpl->variable( 'email_receiver' );

                        $mail->setReceiver( $feedbackReceiver );
                        $mail->setSubject( $subject );
                        $mail->setBody( $templateResult );
                        $mailResult = eZMailTransport::send( $mail );
                    } break;
                    default:
                    {
                        eZDebug::writeWarning( "Unknown feedback type '$feedbackType'", 'user/register' );
                    }
                }
            }

with this block:

$feedbackTypes = $ini->variableArray( 'UserSettings', 'RegistrationFeedback' );
            foreach ( $feedbackTypes as $feedbackType )
            {
                switch ( $feedbackType )
                {
                    case 'email':
                    {
                        $mail = new eZMail();
                        $tpl->resetVariables();
                        $tpl->setVariable( 'user', $user );
                        $tpl->setVariable( 'object', $object );
                        $tpl->setVariable( 'hostname', $hostname );
                        $templateResult =& $tpl->fetch( 'design:user/registrationfeedback.tpl' );
// hack to get email sender into rego feedback
            $emailSender = $ini->variable( 'MailSettings', 'EmailSender' );
            if ( !$emailSender )
                $emailSender = $ini->variable( 'MailSettings', 'AdminEmail' );
            $mail->setSender( $emailSender );
// end hack
                        $feedbackReceiver = $ini->variable( 'UserSettings', 'RegistrationEmail' );
                        if ( !$feedbackReceiver )
                            $feedbackReceiver = $ini->variable( "MailSettings", "AdminEmail" );

                        $subject = ezi18n( 'kernel/user/register', 'New user registered' );
                        if ( $tpl->hasVariable( 'subject' ) )
                            $subject =& $tpl->variable( 'subject' );
                        if ( $tpl->hasVariable( 'email_receiver' ) )
                            $feedbackReceiver =& $tpl->variable( 'email_receiver' );

                        $mail->setReceiver( $feedbackReceiver );
                        $mail->setSubject( $subject );
                        $mail->setBody( $templateResult );
                        $mailResult = eZMailTransport::send( $mail );
                    } break;
                    default:
                    {
                        eZDebug::writeWarning( "Unknown feedback type '$feedbackType'", 'user/register' );
                    }
                }
            }

And it should work, I hate hacking to core but this looks like the only way to get this working.

Cheers!

Pardon me while I burst into flames...

Marko Žmak

Friday 25 November 2005 4:05:38 pm

Yes I hate hacking too. Right now this issue isn't so crucial for me, so I'll rather wait until something like this is in eZ release.

Maybe this could be proposed to eZ team as a improvement/suggestion.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 04:24:38
Script start
Timing: Jan 31 2025 04:24:38
Module start 'layout'
Timing: Jan 31 2025 04:24:38
Module start 'content'
Timing: Jan 31 2025 04:24:38
Module end 'content'
Timing: Jan 31 2025 04:24:38
Script end

Main resources:

Total runtime0.0126 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0043 588.1328151.2109
Module start 'layout' 0.00430.0029 739.343836.6641
Module start 'content' 0.00720.0040 776.0078102.2656
Module end 'content' 0.01120.0013 878.273445.9922
Script end 0.0125  924.2656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002620.8174140.0002
Check MTime0.00129.8660140.0001
Mysql Total
Database connection0.00054.329710.0005
Mysqli_queries0.002520.214030.0008
Looping result0.00000.102510.0000
Template Total0.00118.610.0011
Template load0.00097.194610.0009
Template processing0.00021.402110.0002
Override
Cache load0.00075.348510.0007
General
dbfile0.00032.134580.0000
String conversion0.00000.055040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs