Ivan Gretsky Posted August 2, 2016 Share Posted August 2, 2016 Good day! Is it somehow possible to test sending emails with WireMailSMTP without them actually being send? Something like you can do with regular php mail function in xampp where all the mail is put into a folder. Link to comment Share on other sites More sharing options...
horst Posted August 2, 2016 Author Share Posted August 2, 2016 Hi, no, it isn't possible currently out of the box. You can hook into the ___send() method, and add / change the line 705, where the message normally will be send. Don't know if this is an easy task, as the method is really huge. I find this useful too, and add it to the feature request list of the module, but don't expect an early release. 2 Link to comment Share on other sites More sharing options...
LostKobrakai Posted August 2, 2016 Share Posted August 2, 2016 I've just created a custom WireMail module, which does currently plainly logs all method calls and it's parameters to a logfile. I simply installed that one locally and WireMailSmtp on the live site. 3 Link to comment Share on other sites More sharing options...
horst Posted August 2, 2016 Author Share Posted August 2, 2016 @LostKobrakai: Nice and much better solution! This way, one can use it for all WireMail modules out there! Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted August 2, 2016 Share Posted August 2, 2016 14 minutes ago, LostKobrakai said: I've just created a custom WireMail module, which does currently plainly logs all method calls and it's parameters to a logfile. I simply installed that one locally and WireMailSmtp on the live site. Can you share it? 2 Link to comment Share on other sites More sharing options...
LostKobrakai Posted August 2, 2016 Share Posted August 2, 2016 It could certainly be improved, but here you go. I'll probably not going to release it officially, so if someone would like to take a shot at it, feel free. WireMailTesting.zip 3 Link to comment Share on other sites More sharing options...
szabesz Posted August 2, 2016 Share Posted August 2, 2016 10 minutes ago, LostKobrakai said: It could certainly be improved, but here you go. I'll probably not going to release it officially, so if someone would like to take a shot at it, feel free. WireMailTesting.zip Thank you very much! Link to comment Share on other sites More sharing options...
szabesz Posted August 2, 2016 Share Posted August 2, 2016 1 hour ago, Ivan Gretsky said: Good day! Is it somehow possible to test sending emails with WireMailSMTP without them actually being send? Something like you can do with regular php mail function in xampp where all the mail is put into a folder. Just for the record: Adrian's Tracy Debugger module has smiliar features: 2 Link to comment Share on other sites More sharing options...
adrian Posted August 2, 2016 Share Posted August 2, 2016 4 hours ago, Ivan Gretsky said: Good day! Is it somehow possible to test sending emails with WireMailSMTP without them actually being send? Something like you can do with regular php mail function in xampp where all the mail is put into a folder. If I understand correctly, the Mail panel in Tracy should be what you are looking for. It intercepts all wireMail() calls and shows the results in the panel instead of actually sending the emails. Oops - sorry about repeating the content of @szabesz's post - I replied without reading through all the replies which were on the next page. 2 Link to comment Share on other sites More sharing options...
Zahari M. Posted September 19, 2016 Share Posted September 19, 2016 Hey guys No problems now... Just sharing to the collective knowledge pool should someone do a search... My site was unencrypted http and I was using Zoho Mail with no problems. Here is what I set things to and all was ok: Outgoing Server Name: smtp.zoho.com Port: 587 & Use START_TLS The problem came when I decided to switch the site over to a https site. And once I did that I was not getting any emails sent. Using "Test settings now" showed that I had some authorisation issues. After much experimentation, the issue turned out to be that SMTP user and Sender emailaddress have to be the same value. Previously they were different email address values and worked just fine when the site was http over TLS. And so by making sure that SMTP user and Sender emailaddress are identical, setting the Port to 465, using SSL, and allowing self signed certificates, all is good again when sending via WireMail SMTP and Zoho Mail. At least for me! Hope that saves someone 15 to 30 mins Have a great week everyone, especially all the Mods! Oh and P.S. Thanks horst for this great module! 3 Link to comment Share on other sites More sharing options...
horst Posted October 8, 2016 Author Share Posted October 8, 2016 Updated to be in sync with the new introduced attachment function in core WireMail. (PW 3.0.36) The attachment function was introduced in WireMailSmtp since its initial release. But it hasn't had the option to specify alternative basenames for added attachmentfiles, as it was introduced in PW core this week. Now you can call in both, PW core WireMail and WireMailSMTP: attachment($filename, $alternativeBasename = '') 8 Link to comment Share on other sites More sharing options...
ceberlin Posted November 25, 2016 Share Posted November 25, 2016 Not sure it has been mentioned before: If changing the email-name, the saved password is silently removed. Is this intended? I would like a warning here, if there is a case where the saved password gets reset for some reason and needs to be entered again. 1 Link to comment Share on other sites More sharing options...
horst Posted November 25, 2016 Author Share Posted November 25, 2016 Hhm, I agree. I need to check this. Thanks. Link to comment Share on other sites More sharing options...
ethanbeyer Posted December 5, 2016 Share Posted December 5, 2016 I'm looking for a way to dynamically change the SMTP server settings for this module depending on my environment. If I'm on my local box, I want to use Mailtrap or Debugmail.io in order to prevent test emails from going to real addresses – but on the live server I want to maintain my Mandrill credentials. I thought it would be as simple as this: $this->addHookAfter("TemplateFile::render", function($event) { $config = wire('config'); $wmsmtp = wire('modules')->get('WireMailSmtp'); if($config->env == "dev") { $wmsmtp->set('smtp_host', "different-smtp-server.com"); $wmsmtp->set('smtp_port', "25"); $wmsmtp->set('smtp_user', "username2"); $wmsmtp->set('smtp_password', "a_different_password"); } }); But that doesn't seem to be working. I'm sure I'm using a bad hook for this, but I can't find a hook for when Module Configs are loaded - only saved - and I am almost positive that ProcessWire can do this. I just don't know how! Anybody done anything like this before? Link to comment Share on other sites More sharing options...
ethanbeyer Posted December 5, 2016 Share Posted December 5, 2016 5 minutes ago, ethfun said: I'm looking for a way to dynamically change the SMTP server settings for this module depending on my environment. If I'm on my local box, I want to use Mailtrap or Debugmail.io in order to prevent test emails from going to real addresses – but on the live server I want to maintain my Mandrill credentials. I thought it would be as simple as this: $this->addHookAfter("TemplateFile::render", function($event) { $config = wire('config'); $wmsmtp = wire('modules')->get('WireMailSmtp'); if($config->env == "dev") { $wmsmtp->set('smtp_host', "different-smtp-server.com"); $wmsmtp->set('smtp_port', "25"); $wmsmtp->set('smtp_user', "username2"); $wmsmtp->set('smtp_password', "a_different_password"); } }); But that doesn't seem to be working. I'm sure I'm using a bad hook for this, but I can't find a hook for when Module Configs are loaded - only saved - and I am almost positive that ProcessWire can do this. I just don't know how! Anybody done anything like this before? I'm a big dummy. It works if you change `$config->env == "dev"` to `$config->env = "dev"`. I had the wrong operator. Link to comment Share on other sites More sharing options...
adrian Posted December 5, 2016 Share Posted December 5, 2016 6 minutes ago, ethfun said: $config->env = "dev" That will just set it to dev and proceed - it won't actually check the value of $config->env Just an option for you - TracyDebugger has a Mail Interceptor panel which which intercepts all outgoing emails and displays their content in the panel instead - might be a decent option for what you are trying to achieve? 4 Link to comment Share on other sites More sharing options...
ethanbeyer Posted December 5, 2016 Share Posted December 5, 2016 @adrian probably! After I wrote that second message I was like, "waaaait a minute - that doesn't seem right..." Does Tracy show the rendered HTML of the email and all the recipients, etc? Link to comment Share on other sites More sharing options...
adrian Posted December 5, 2016 Share Posted December 5, 2016 Yes, Tracy shows the rendered HTML and all recipients. Back to your hook question, there is: getModuleConfigInputfields which may suit your needs, but haven't though into it too much, but it does seem to be what you were asking about. https://github.com/processwire/processwire/blob/35df716082b779de0e53a3fcf7996403c49c9f8a/wire/core/Modules.php#L3534 1 Link to comment Share on other sites More sharing options...
Macrura Posted December 6, 2016 Share Posted December 6, 2016 @ethfun - if you are able to figure out how to dynamically change the smtp creds let me know - that would be super useful; for example i am doing a lot of CRM type of builds on top of PW these days, and sending email needs to be flexible to where you can change the sender and have that use a totally different account; Currently i use a modified version of WireMailMailgun which has the functionality to change those things before you send. Link to comment Share on other sites More sharing options...
Bigizmund Posted December 14, 2016 Share Posted December 14, 2016 Hello Uploading files from a form and attaching these works well. What if I do want to send a string (stream) value as an email attachment, is there any way of doing that, something like Quote addStringAttachment() function in PHPMailer? Link to comment Share on other sites More sharing options...
horst Posted December 14, 2016 Author Share Posted December 14, 2016 45 minutes ago, Bigizmund said: Hello Uploading files from a form and attaching these works well. What if I do want to send a string (stream) value as an email attachment, is there any way of doing that, something like function in PHPMailer? unfortunately not. But you may find a good startingpoint here: https://processwire.com/talk/topic/14072-add-image-from-input-typefile-possible-or-must-it-be-wireupload/#comment-126476 look at the $filename = myImageExtract($data, $basename); part, - specially the function myImageExtract with the WireTempDir class. 1 Link to comment Share on other sites More sharing options...
raulyjo Posted January 2, 2017 Share Posted January 2, 2017 (edited) Hi, i have a problem with my Wire Mail SMTP Module. Apparently, the form works, but something is wrong with the email, I think, because when you send the email address, there is with a yellow mark. I'm going to show you: And there is my code: <script> app.controller('ContactoCtrl',function($scope, $http){ $scope.page=<?php echo $page->toJSON() ?>; $scope.enviarEmail = function(){ $http.post( '/videsil/pwapi/', { do: 'getEmail', data:{ 'from': $scope.email, 'subject': $scope.subject, 'message': $scope.name + ' te ha enviado este mensaje: ' + $scope.message }}) .success( function (result) { console.log("email enviado", result); $scope.name = null; $scope.email = null; $scope.subject = null; $scope.message = null; }) .error(function(data){ console.log("NO enviado", data) }); } }); </script> <div ng-controller="ContactoCtrl"> <section id="contact"> <div id="map" style="height:650px" data-latitude="39.4576737" data-longitude="-0.3628944,14" ></div> <div class="container-wrapper"> <div class="container"> <div class="row"> <div class="col-sm-4 col-sm-offset-8"> <div class="contact-form"> <h3 class="letravidesil">Contacto</h3> <address> <strong>Videsil S.L.</strong><br> C/ Nino Bravo, 5, 46812 <br> Ayelo de Malferit, Valencia <br> <abbr title="Phone"></abbr> (+34) 96 236 0123 </address> <form id="main-contact-form" name="contact-form" method="post" action="#"> <div class="form-group"> <input type="text" ng-model="name" name="name" class="form-control" placeholder="Nombre y teléfono" required> </div> <div class="form-group"> <input type="email" ng-model="email" name="email" class="form-control" placeholder="Email" required> </div> <div class="form-group"> <input type="text" ng-model="subject" name="subject" class="form-control" placeholder="Asunto" required> </div> <div class="form-group"> <textarea ng-model="message" class="form-control" rows="8" placeholder="Mensaje" required></textarea> </div> <button type="submit" class="btn btn-primary" name="submit" value="Enviar" ng-click="enviarEmail()">Enviar</button> </form> </div> </div> </div> </div> </div> </section><!--/#bottom--> </div> I don't know why is not working, because 6 months ago there was working with the same settings. Help please Edited January 2, 2017 by kongondo Moved your topic to the module's own support forum Link to comment Share on other sites More sharing options...
raulyjo Posted January 2, 2017 Share Posted January 2, 2017 I did the test of the module and --> SUCCESS! SMTP settings appear to work correctly. Link to comment Share on other sites More sharing options...
raulyjo Posted January 6, 2017 Share Posted January 6, 2017 Can anybody help me? Link to comment Share on other sites More sharing options...
flydev Posted January 15, 2017 Share Posted January 15, 2017 I helped @raulyjo through MP, the problem did not come from the module. It was missing a page and the template code that were probably forgotten during the migration. All good now 4 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