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.