7Studio

"Login/Register/Profile" module - how to change default "from" email address

Recommended Posts

This is one of my first posts, so I would like to say hello to everyone!

I'm building a site where I'm using latest "Login/Register/Profile" module from @ryan .

Everything works great, except one small thing, while creating new account, in confirmation email, in section "from" I see email address in format like:

processwire@www.mydomain.com

I guess that I'm missing something obvious, but is there is a way to change "from" email address?

In the core "Forgot Password" module there is an option to set "from" email address,  but I don't see anything similar here.

I haven't' found any information about this in the documentation or in the forums.

Does anyone have some tips or suggestions how this email address can be changed?

Thanks in advance!

Tomasz

Share this post


Link to post
Share on other sites

I've checked out the module source and it doesn't seem to have a customizable `from` address field, so WireMail defaults to admin email.

public function ___send() {

    $from = $this->from;
    if(!strlen($from)) $from = $this->wire('config')->adminEmail;
    if(!strlen($from)) $from = 'processwire@' . $this->wire('config')->httpHost; 

Add this line to site/config.php

$config->adminEmail = 'my@email.com';

If you want to change the admin email for just LoginRegister.module, than put the line above where you execute the module.

$config->adminEmail = 'my@email.com';
$modules->LoginRegister->execute();

 

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

@abdus, thanks a lot!

I was trying to add the "from" email address directly inside the module function - sendConfirmationEmail(), but I was worried about the updates,

Setting admin email address directly in the config

$config->adminEmail = 'my@email.com';

works like a charm!
Thanks once again ;)

Share this post


Link to post
Share on other sites
11 hours ago, abdus said:

I've checked out the module source and it doesn't seem to have a customizable `from` address field, so WireMail defaults to admin email.

I think this default behaviour is totally wrong - $config->adminEmail should not be used as the fallback "from" address by WireMail. I opened a LoginRegister issue and core feature request.

  • Like 3

Share this post


Link to post
Share on other sites

@Robin S, you are right, if admin email address is used for admin notifications (as you've mentioned in issue, i'm still quite new to pw, didn't know that) then the best option would be to have a separate config for the "from" address for WireMail class, or at least separate option in the login/register module.

I did wanted to use generic noreply@mydomain.com email here, the same as for password reset. As for now I've added desired "from" email address directly in the module sendConfirmationEmail() function:

$mail = new WireMail();
$mail->from = ('noreply@mydomain.com');

But I hope your suggestion will be taken into consideration.
Thank you for your input!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.