7Studio Posted October 12, 2017 Share Posted October 12, 2017 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 Link to comment Share on other sites More sharing options...
abdus Posted October 12, 2017 Share Posted October 12, 2017 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(); 4 1 Link to comment Share on other sites More sharing options...
7Studio Posted October 12, 2017 Author Share Posted October 12, 2017 @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 Link to comment Share on other sites More sharing options...
Robin S Posted October 12, 2017 Share Posted October 12, 2017 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. 3 Link to comment Share on other sites More sharing options...
7Studio Posted October 13, 2017 Author Share Posted October 13, 2017 @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! Link to comment Share on other sites More sharing options...
rareyush Posted July 19, 2018 Share Posted July 19, 2018 On 10/13/2017 at 12:44 PM, 7Studio said: @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! this is not working anymore and I am getting two mails Link to comment Share on other sites More sharing options...
7Studio Posted July 20, 2018 Author Share Posted July 20, 2018 On 7/19/2018 at 11:35 AM, rareyush said: this is not working anymore and I am getting two mails Hi @rareyush, I've just checked that once again and this solution still works fine on latest dev version of PW in one of our site (login register module in v 0.2): in loginRegister.module file, after line 677: $mail = new WireMail(); just add your email address: $mail->from = ('noreply@mydomain.com'); or please post your changes to the original file. Link to comment Share on other sites More sharing options...
rareyush Posted July 22, 2018 Share Posted July 22, 2018 On 7/21/2018 at 1:38 AM, 7Studio said: Hi @rareyush, I've just checked that once again and this solution still works fine on latest dev version of PW in one of our site (login register module in v 0.2): in loginRegister.module file, after line 677: $mail = new WireMail(); just add your email address: $mail->from = ('noreply@mydomain.com'); or please post your changes to the original file. I did these changes but still I am getting two emails for confirmation Link to comment Share on other sites More sharing options...
wbmnfktr Posted July 22, 2018 Share Posted July 22, 2018 39 minutes ago, rareyush said: I did these changes but still I am getting two emails for confirmation I have had a similar problem while using Googlemail / G-Suite as outgoing and incoming addresses. Try as outgoing something like @yahoo.com and as recipient something like @gmx.net. You don't have to use those freemailers but you get the idea. Two totally separated servers and domains. Another thing could be a thing in cPanel powered hostings. Those sometimes have kind of a hiccup with who is actually the mail server for that domain. Link to comment Share on other sites More sharing options...
7Studio Posted July 27, 2018 Author Share Posted July 27, 2018 On 7/22/2018 at 4:59 PM, rareyush said: I did these changes but still I am getting two emails for confirmation No idea why this may happens, maybe you have some third party modules installed that affects wiremail class? Maybe you can check if the same issue appear on clean install? What about @wbmnfktr suggestions? Link to comment Share on other sites More sharing options...
rareyush Posted August 1, 2018 Share Posted August 1, 2018 On 7/22/2018 at 9:07 PM, wbmnfktr said: I have had a similar problem while using Googlemail / G-Suite as outgoing and incoming addresses. Try as outgoing something like @yahoo.com and as recipient something like @gmx.net. You don't have to use those freemailers but you get the idea. Two totally separated servers and domains. Another thing could be a thing in cPanel powered hostings. Those sometimes have kind of a hiccup with who is actually the mail server for that domain. I have my site on my own vps using centos and centos web panel and using default mail services there. On 7/27/2018 at 9:45 PM, 7Studio said: No idea why this may happens, maybe you have some third party modules installed that affects wiremail class? Maybe you can check if the same issue appear on clean install? What about @wbmnfktr suggestions? I checked there no 3rd party module present Link to comment Share on other sites More sharing options...
wbmnfktr Posted August 1, 2018 Share Posted August 1, 2018 1 hour ago, rareyush said: I have my site on my own vps using centos and centos web panel and using default mail services there. So... you haven't tested it with external addresses, right? Link to comment Share on other sites More sharing options...
rareyush Posted August 8, 2018 Share Posted August 8, 2018 On 8/1/2018 at 3:43 PM, wbmnfktr said: So... you haven't tested it with external addresses, right? like gmail and yahoo no, there are around 6 7 mail on that domain I have to migrate all the mail if I have to do that. Link to comment Share on other sites More sharing options...
rareyush Posted November 2, 2018 Share Posted November 2, 2018 I rebuild everything and still, I'm having a same problem receiving two emails whenever a user register. Link to comment Share on other sites More sharing options...
Pip Posted August 14, 2020 Share Posted August 14, 2020 And fast forward to 2020, has anyone figured this out yet? Tried doing this but as expected, it is overwritten. ? Changing the config is out of the question because this would mean all other updates will bounce off. protected function sendConfirmationEmail($email, $confirmCode) { $config = $this->wire('config'); $confirmURL = $this->wire('page')->httpUrl() . "?register_confirm=" . urlencode($confirmCode); $mail = new WireMail(); $mail->subject(sprintf($this->_('Confirm account at %s'), $config->httpHost)); $mail->to($email); $mail->from('noreply@domain.com'); Link to comment Share on other sites More sharing options...
7Studio Posted August 15, 2020 Author Share Posted August 15, 2020 @Pip You don't have to hack the core module file, as suggested by abdus above, you can define admin email address in your config.php file, so it won't be overwritten by any updates: On 10/12/2017 at 11:53 AM, 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. 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(); Link to comment Share on other sites More sharing options...
7Studio Posted August 15, 2020 Author Share Posted August 15, 2020 I've created a new "pull request" that adds configurable option to define custom "from" email address directly in the module settings. https://github.com/ryancramerdesign/LoginRegister/pull/28 I hope that Ryan will review this "pull request" and include this small change in future versions. Link to comment Share on other sites More sharing options...
Pip Posted August 15, 2020 Share Posted August 15, 2020 5 hours ago, 7Studio said: @Pip You don't have to hack the core module file, as suggested by abdus above, you can define admin email address in your config.php file, so it won't be overwritten by any updates: Thanks on this! Really look forward on the pull request to go through. 1 Link to comment Share on other sites More sharing options...
Pip Posted August 15, 2020 Share Posted August 15, 2020 9 hours ago, 7Studio said: $config->adminEmail = 'my@email.com'; $modules->LoginRegister->execute(); Tried this. Though theoretically it is sound, email address is still stiff. I got my admin email address still. Worst even if I do this, my Login Register comes out empty. I have do this in order to work (just to have the module work work): 9 hours ago, 7Studio said: <?php $config->adminEmail = 'my@email.com'; ?> <?=$modules->LoginRegister->execute(); ?> Take note: Email address is still the same as admin. I've checked the error logs, everything seems to be in working order. Link to comment Share on other sites More sharing options...
Pip Posted August 15, 2020 Share Posted August 15, 2020 I tried changing my admin email address. It's still stuck with the old one. Searched the whole database as well as any hard coded ones, none. What sorcery is this, @ryan? ---- Sincerely, dumbfounded struck confused noob PW user. ? Link to comment Share on other sites More sharing options...
Pip Posted August 18, 2020 Share Posted August 18, 2020 On 8/16/2020 at 4:05 AM, Pip said: I tried changing my admin email address. It's still stuck with the old one. Searched the whole database as well as any hard coded ones, none. What sorcery is this, @ryan? ---- Sincerely, dumbfounded struck confused noob PW user. ? So apparently after going through stuff the reason as to why the email address never changed is due to the XAMPP settings. Despite setting the settings that way, it overwrites the sender still. Oh wells. Silly me calling it sorcery. ? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now