raulyjo Posted January 16, 2017 Share Posted January 16, 2017 flydev was amazing 2 Link to comment Share on other sites More sharing options...
alexpi Posted February 2, 2017 Share Posted February 2, 2017 Hello all, I am trying to setup WireMailSMTP with the Gmail SMTP server, trying everything I read in this topic with no success. The error I get that seems to say something (but I don't know what!) is => WireMailSmtpConfig: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbt0 The settings I am using are: (I think I entered every combination possible!) local hostname: the site's domain (is this wrong? I don't know if it's relevant but this domain is an addon domain) SMTP hostname: smtp.gmail.com SMTP port: 587 use START_TLS SMTP user: my email from Google SMTP password: my above email password Am I doing something wrong? Link to comment Share on other sites More sharing options...
LostKobrakai Posted February 2, 2017 Share Posted February 2, 2017 Are you using 2 factor authentification? If so make sure you generate an app password instead of using the account password. Link to comment Share on other sites More sharing options...
alexpi Posted February 2, 2017 Share Posted February 2, 2017 7 minutes ago, LostKobrakai said: Are you using 2 factor authentification? If so make sure you generate an app password instead of using the account password. No, I am not. Link to comment Share on other sites More sharing options...
alan Posted February 2, 2017 Share Posted February 2, 2017 In case using Google for SMTP is the problem (perhaps Google is or may one day, restrict use?), a new account with Postmark gives you 25,000 'credits', but more importantly they are great for transactional emails. Link to comment Share on other sites More sharing options...
alexpi Posted February 2, 2017 Share Posted February 2, 2017 2 hours ago, alan said: In case using Google for SMTP is the problem (perhaps Google is or may one day, restrict use?), a new account with Postmark gives you 25,000 'credits', but more importantly they are great for transactional emails. Ok, I signed up for a similar service. It works now, but I have a concern: Since my site's contact form receives emails from various people (the WireMail->from() value is different every time), I am asked to validate every single one before it passes. Is this the way these services work? Link to comment Share on other sites More sharing options...
alan Posted February 2, 2017 Share Posted February 2, 2017 7 minutes ago, alexpi said: I am asked to validate every single one before it passes. Is this the way these services work? I choose to have the 'From' as noreply@example.com (the domain the site is on) and I ensure that domain is valid (good SPF, DKIM etc) then one validation and you're done. 1 Link to comment Share on other sites More sharing options...
LostKobrakai Posted February 2, 2017 Share Posted February 2, 2017 Send them from your own domain and just set the Reply-To header to the email of the contacting person. Automatically sending emails in the name of others isn't in vogue anymore with all those spammer out there. Link to comment Share on other sites More sharing options...
chrizz Posted February 28, 2017 Share Posted February 28, 2017 I was wondering if it'll be possible to hook the ___send method to manipulate the recipient(s) and body of the mail. I was able to hook the method basically but I couldn't manage to manipulate the original data :/ Thanks in advance for any hints use case for this: In debug mode (e.g. local or on staging) all mails should be send to a dedicated dropbox instead of the original recipient. This information should be added to the mail body instead. Original e-mail - send to xy@domain.com Hello XY, thanks for your email. [...] Manipulated e-mail - send to dropbox@developer.net # Debug Info # Original recipient: xy@domain.com Hello XY, thanks for your email. [...] Link to comment Share on other sites More sharing options...
adrian Posted February 28, 2017 Share Posted February 28, 2017 1 minute ago, chrizz said: use case for this: In debug mode (e.g. local or on staging) all mails should be send to a dedicated dropbox instead of the original recipient. Not sure if it suits your needs or not, but TracyDebugger has a Mail Interceptor panel that intercepts all outgoing emails and instead shows all their details/content in the panel. If not, I can look into changing the address like you want, but thought I'd mention that first just in case. 1 Link to comment Share on other sites More sharing options...
chrizz Posted February 28, 2017 Share Posted February 28, 2017 @adrian although tracy seems to be really oversized for this use case but it is quite interesting and it works thanks for the tip! Link to comment Share on other sites More sharing options...
adrian Posted February 28, 2017 Share Posted February 28, 2017 @chrizz - I am not really sure why this works - not much time to test right now, but it does. $this->addHookBefore('WireMail::send', null, function($event) { $event->object->toName = 'testrecipient@gmail.com'; }); I would have thought it would be: $event->object->to, but doing that just adds another address. This seems to overwrite the existing one. Keep in mind I am not sure if this works with multiple recipients, but hopefully a decent start to get you going. Please let us know what you find. PS - I put this in site/ready.php 1 Link to comment Share on other sites More sharing options...
chrizz Posted March 1, 2017 Share Posted March 1, 2017 @adrian thanks a lot for sharing this and for pointing me in the right direction! To clear the original values you can just pass "null" to the "to" method:https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/WireMail.php#L152 Same works for cc & bcc, but to be honest, I only tested this in combination with WireMailSmtp. It might look different without WireMailSmtp (e.g. no cc/bcc) The whole hook function looks like this and it works as expected. $this->addHookBefore('WireMailSmtp::send', null, function($event) { if(!$this->config->debug) { // when not in debug mode do nothing return; } $mail = &$event->object; // store orgiginal recpients $recipients = array( 'to' => $mail->to, 'toName' => $mail->toName, 'cc' => $mail->cc, 'ccName' => $mail->ccName, 'bcc' => $mail->bcc, ); // reset all original recipients $mail->to(null); $mail->cc(null); $mail->bcc(null); // add debug recepient $mail->to = 'Dropbox <dropbox@my-domain.com>'; // create debug information for mailbody $debug_body = '### DEBUG INFO ###<br />'; $debug_body .= 'TO: '.implode($recipients['to'], ', ').'<br />'; $debug_body .= 'CC: '.implode($recipients['cc'], ', ').'<br />'; $debug_body .= 'BCC: '.implode($recipients['bcc'], ', ').'<br />'; $debug_body .= '### / DEBUG INFO ###<br /><br />'; // replace original mailbody $new_mailbody = str_replace('<body>', '<body>'.$debug_body, $mail->bodyHTML); $mail->bodyHTML($new_mailbody); return; }); 3 Link to comment Share on other sites More sharing options...
palacios000 Posted March 13, 2017 Share Posted March 13, 2017 Hi, I have a problem with this module. Actually is a problem linked with another module FrontendUser, but considering FrontendUser is working fine if I uninstall wireMailSMTP, maybe there is a conflict somewhere... The scenario is this: I'm trying to send an email from FrontendUser, the reset password email, but it doesn't work. If I check the logs I read: Error in hnsmtp::send : 550-Verification failed for <processwire@www.mywebsite.it> This is strange because all other emails sent from API or PW are delivered without any issue, and on wireMailSMTP settings page I have all my SMTP credentials set up correctly. Only this "reset password email" seems to load the default wireMailSMTP settings. Any idea what goes wrong? Thanks a lot I'm on PW 3.0.50 - wireMailSMTP 0.2.3 - FrontednUser 0.9.3 Link to comment Share on other sites More sharing options...
horst Posted March 13, 2017 Author Share Posted March 13, 2017 Only thing what comes to my mind is different user rights!? Can you somehow log user name / role for the different scenarios? (Maybe by temporarily add a log into the send function) 1 Link to comment Share on other sites More sharing options...
Robin S Posted March 13, 2017 Share Posted March 13, 2017 10 hours ago, palacios000 said: The scenario is this: I'm trying to send an email from FrontendUser, the reset password email, but it doesn't work. I think maybe this module uses the core ProcessForgotPassword module. You may need to set the config option for that module: "Email address to send messages from" 4 Link to comment Share on other sites More sharing options...
palacios000 Posted March 13, 2017 Share Posted March 13, 2017 1 hour ago, Robin S said: You may need to set the config option for that module: "Email address to send messages from" Thanks @Robin S That solved the problem! Link to comment Share on other sites More sharing options...
palacios000 Posted April 4, 2017 Share Posted April 4, 2017 Sorry I can't add an attachment... The email is sent without attachment $pdf = $homepage->pdf_marketing->url; $mail = wireMail(); $mail->to($emailg); $mail->subject($subject); $mail->bodyHTML($emailMessage); $mail->attachment($pdf); $numSent = $mail->send(); And the log tells me Error in $WireMailSmtp->attachFile($filename): Not existing or not readable file: /site/assets/files/1/consigli-alimentari-fit4all.pdf And I tried absolute URL, again same error Error in $WireMailSmtp->attachFile($filename): Not existing or not readable file: http://www.fit4all.it/site/assets/files/1/consigli-alimentari-fit4all.pdf The file is there, available to see even from browser. What I am doing wrong? Link to comment Share on other sites More sharing options...
adrian Posted April 4, 2017 Share Posted April 4, 2017 @palacios000 - you need the "filename" rather than "url" of the attachment. Also if the files field allows more than one, make sure to do first() etc as well. 4 Link to comment Share on other sites More sharing options...
palacios000 Posted April 6, 2017 Share Posted April 6, 2017 THANKS @adrian ! I had to go back to the root folder, in my case "/home/accountname/public_html/site/assets/files/1/" Link to comment Share on other sites More sharing options...
horst Posted April 6, 2017 Author Share Posted April 6, 2017 On 6.4.2017 at 11:45 AM, palacios000 said: THANKS @adrian ! I had to go back to the root folder, in my case "/home/accountname/public_html/site/assets/files/1/" you need to use ->filename instead of ->url $pdf = $homepage->pdf_marketing->filename; 3 Link to comment Share on other sites More sharing options...
ank Posted April 19, 2017 Share Posted April 19, 2017 Is there a way to set the reply address ? ->reply("xxx@xxx.xx") ? Link to comment Share on other sites More sharing options...
horst Posted April 19, 2017 Author Share Posted April 19, 2017 1 hour ago, ank said: Is there a way to set the reply address ? ->reply("xxx@xxx.xx") ? In the modules config screen you can set it under "sender_reply". Also a "sender_errors_to" is available. If you need to set it dynamically, you must go the workaround with modifying module config-settings via API. If so, you will find examples here in this thread or the forums in general. you can use this: $data = wire('modules')->getModuleConfigData("WireMailSmtp"); // or, regarding on scope, $data = $modules->getModuleConfigData("WireMailSmtp"); than modify the reply adress: $data["sender_reply"] = "you@example.com"; after modifying, you can write it back: wire('modules')->saveModuleConfigData("WireMailSmtp", $data); // or $modules->saveModuleConfigData("WireMailSmtp", $data); 2 Link to comment Share on other sites More sharing options...
ank Posted April 19, 2017 Share Posted April 19, 2017 Thanks @horst, i knew it was possible in the backend, but i was wondering if it was simple to do it dynamicly. Link to comment Share on other sites More sharing options...
horst Posted April 19, 2017 Author Share Posted April 19, 2017 2 minutes ago, ank said: Thanks @horst, i knew it was possible in the backend, but i was wondering if it was simple to do it dynamicly. @ank I updated my above post with an example. ;-) 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