Jump to content

WireMailSmtp


horst

Recommended Posts

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.

  • Like 2
Link to comment
Share on other sites

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?

  • Like 2
Link to comment
Share on other sites

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:

 

  • Like 2
Link to comment
Share on other sites

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.

578682754ac2f_ScreenShot2016-07-13at11.03.10AM.png.f4fb804b1c32109d39b1a00d58ac49c1.png

Oops - sorry about repeating the content of @szabesz's post - I replied without reading through all the replies which were on the next page.

  • Like 2
Link to comment
Share on other sites

  • 1 month later...

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!

 

 

 

 

 

 

 

  • Like 3
Link to comment
Share on other sites

  • 3 weeks later...

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 = '')

 

  • Like 8
Link to comment
Share on other sites

  • 1 month later...

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.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

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

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

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?

  • Like 4
Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

@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

  • 2 weeks later...
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.

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

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: 

Sin título.jpg

22.jpg

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 by kongondo
Moved your topic to the module's own support forum
Link to comment
Share on other sites

  • 2 weeks later...
  • SebastianP changed the title to Strange PHP error in WireMailSmtp: unexpected fully qualified name "\getmessage"

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
×
×
  • Create New...