horst

WireMailSmtp

Recommended Posts

It could be. You'd normally get an error/warning saying function is already defined, though.

Share this post


Link to post
Share on other sites

I guess the different case may have allowed it to sneak through - I can confirm I'm not seeing the issue now that I've renamed my function.

I'll follow up if the issue remains resolved.

Thanks for your help!

Share this post


Link to post
Share on other sites

I upgraded to version 0.2.6 today and cannot make use of the module.  It seems to not save the SMTP Password anymore.  I can send additional SMTP Configuration information via PM, if necessary.  Once I reverted back to version 0.2.5 everything worked as before.

Share this post


Link to post
Share on other sites
3 minutes ago, cstevensjr said:

I upgraded to version 0.2.6 today and cannot make use of the module.  It seems to not save the SMTP Password anymore.  I can send additional SMTP Configuration information via PM, if necessary.  Once I reverted back to version 0.2.5 everything worked as before.

Shit, my bad, sent another PR

https://github.com/horst-n/WireMailSmtp/pull/10

  • Like 1

Share this post


Link to post
Share on other sites
Just now, abdus said:

Shit, my bad, sent another PR


smtp_password

@abdus please update the version too in your PR. Thanks.

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, horst said:

please update the version too in your PR. Thanks.

Done.

image.png.587d5632ff34a4966836d89694253ef1.png

  • Like 2

Share this post


Link to post
Share on other sites

Done too!

Its updated to 0.2.7. All in all we only used 7 minutes to react on Charles issue report! Cool! :)

 

  • Like 6

Share this post


Link to post
Share on other sites
2 hours ago, horst said:

Done too!

Its updated to 0.2.7. All in all we only used 7 minutes to react on Charles issue report! Cool! :)

 

Thanks all (@abdus and  @horst) for the quick response.  I'd be lost without this module, I use it on every site.  Also thanks to @ryan for having the feature of saving the previous version of each module when using his Upgrade module. 

  • Like 2

Share this post


Link to post
Share on other sites

I try to connect to our SMTP server, which has no authentification, default port 25, but when I test the Settings I get the following error

  •  server does not require authentication

Share this post


Link to post
Share on other sites

Hi @dreerr, sorry, this is a known limitation: The test is only functional for connections with authentication.

But regardless of the failing test in this case, it should be possible to send mails without authentication. Hvae you tried it? Does it work?

Share this post


Link to post
Share on other sites

In the log files I get the error when trying to send a mail:

 
Error in hnsmtp::send : cannot connect to smtp-server!

Share this post


Link to post
Share on other sites

Hhm, sad. I send you a PM.

Share this post


Link to post
Share on other sites

Hi, I am trying to implement wireMail attachment method into my form. I started a thread in the 'getting started' area but maybe this is the better place for it since it is specifically about wireMail. Basically I just want someone to be able to add an image to a form, then send it in an email. 

The field in my form is:

    <input type="file" name="user_image" />

I've been looking at this thread and trying to cobble something together. I am very new to php. I know this is wrong but this is as far as I can make out what I'm supposed to do:

$user_image = 'user_image->$filename';
$mail = wireMail();
$mail->attachment($filename);
$mail->send(); 

Any links to any other forum threads, or php info, would be greatly appreciated. I've been trying to figure this out for two days. The documentation at

 https://processwire.com/api/ref/wire-mail/attachment/

is nice and simple but too simple for where my understanding is at. Thanks!

Share this post


Link to post
Share on other sites
20 hours ago, ryanC said:

$user_image = 'user_image->$filename';
$mail = wireMail();
$mail->attachment($filename);
$mail->send(); 

 

There seems to be a little quirks with the different parts.

First, a user will submit a from with a filefield. You need to check if there was sent a file, and if yes, get the file from this field. Do you use the GET or POST method with your form submit? Please refer to the PW vars $input->post->{...FIELDNAME...} or $input->get->{...FIELDNAME...}.

Once you have your file / filename, you can attach it to the wiremail object.

To check your process step by step, you may write some little prooflines into your script, like:

$filename = $input->post->.... ; // get the file / filename from your form submission

// now debug / check, if all went good for this step
var_dump(is_file($filename));  // also possible PHP functions: is_readable($filename)
die('DEBUG BREAK AT: ' . __FILE__ . ':' . __LINE__);

If this is true, you can delete this debug lines from your script and sent the email with attachment to a testaccount first. :)

  • Like 1

Share this post


Link to post
Share on other sites

Thanks horst, my form uses POST method. I will see if I can apply some of what you wrote to my code.

Share this post


Link to post
Share on other sites

Hi there,

after installing the Wire Mail Module, i get a Fatal Error message when opening the settings page:

Recoverable Fatal Error: Argument 1 passed to InputfieldWrapper::add() must be an instance of Inputfield, array given, called in /var/www/vhosts/mydomain.de/httpsdocs/site/modules/WireMailSmtp/WireMailSmtpConfig.php on line 60 and defined (line 162 of /var/www/vhosts/mydomain.de/httpsdocs/wire/core/InputfieldWrapper.php) This error message was shown because you are logged in as a Superuser. Error has been logged.


I'm using ProcessWire 2.5.3. Can anyobody help me?

Thanks!

Recoverable Fatal Error: Argument 1 passed to InputfieldWrapper::add() must be an instance of Inputfield, array given, called in /var/www/vhosts/mydomain.de/httpsdocs/site/modules/WireMailSmtp/WireMailSmtpConfig.php on line 60 and defined (line 162 of /var/www/vhosts/mydomain.de/httpsdocs/wire/core/InputfieldWrapper.php)
This error message was shown because you are logged in as a Superuser. Error has been logged.

Share this post


Link to post
Share on other sites

Hi @Mailte,

thats bad. There were a pull request added some time ago, that should make the config page a bit more shiny.

Unfortunately, now I recognized that it broke the backwards compatibility. I have tested it with PW 2.5.0, where I get exactly the error you described.
With PW 2.5.11+ it runs as expected, without errors!

So, you may have 2 options now:

my prioritized option is to get the WireMail SMTP version 0.2.5, they are known to work with PW 2.4.1 - 2.5.10 too,
(
https://github.com/horst-n/WireMailSmtp/tree/532dd94752597a4b2b9f3a2c02ef48b21db77f84)

or upgrade your pw version to at least 2.5.11 or 2.6.0.
But when upgrading your PW version, please first try it in a copy, not on a live site. With and after PW +2.5.11 there were some changes in images variation naming scheme, that may lead to issues like massive images recreations and a lot of orphaned variation files!

Or, you have to wait until I get time to rearange the last commits to also work with prior PW versions than 2.5.11, as it was before.

 

I updated the code of the config screen to make it backwards compatible again.

Please download / install the latest module version 0.3.0 to use it with PW 2.5.3

:)

https://github.com/horst-n/WireMailSmtp  or  http://modules.processwire.com/modules/wire-mail-smtp/

 

Edited by horst
added note to the updated module version
  • Like 2

Share this post


Link to post
Share on other sites

Hi there! 

Struggling to get this to work with Office365 and TLS, has anyone succeeded with this? I've tried different combinations, but all I get is "ERROR: SMTP settings did not work." and "could not start TLS connection encryption protocol". Anything I could try? Thanks!

Share this post


Link to post
Share on other sites

Hi @nikoka

I was struggling with an other Microsoft service yesterday and make me think that your issue is with your entered information.

Try :

  • SMTP port: 587
  • SMTP user: yourmail@provider.com
  • Check START-SSL
  • Uncheck use SSL
  • Like 1

Share this post


Link to post
Share on other sites

Thanks @flydev,

Tried with those, in addition with the SMTP server: smtp.office365.com, but no luck there.

Share this post


Link to post
Share on other sites

I just tested with an Office365 account with these settings, it works well. WireMailSMTP 0.3.0 here.

Look like its your credentials that are incorrect ?  Double check ;)

 

smtp.thumb.png.19fcd8a84f8e76a1e96e78304f38dbf6.png

Edited by flydev
config screen + WMS version
  • Like 2

Share this post


Link to post
Share on other sites

Emailaddresses in CC array keep being encoded

I have a small module with a function that sends emails to me(Admin) and users who act as moderators.
What I want to do is basically this:(from first post here)

$options = array(
    'sendSingle' => true,
    'cc' => array('person1@example.com', 'person2@example.com', 'person3@example.com')
    );
$numSent = wireMail($to, '', $subject, $textBody, $options); 

But I want to CC to users of a certain role, and retrieve the users like that:

$address_rev = wire('users')->find("roles=revisor");

Now I have to build the array for the $options:

foreach($address_rev as $one){ $emailcc .= "'" . $one->email . "',"; }
$emailcc = rtrim($emailcc, ',');// remove the last comma

$options = array(
    'sendSingle' => true,
    'cc' => array("$emailcc")
    );

But sending fails with the quotes being encoded by PWs sanitizer(I assume)
Invalid email address (&#039;person1@example.com&#039;, &#039;person2@example.com&#039;) (in path_to....\wire\core\WireMail.php line 105)
Why?
It doesn't happen when I hardcode the array like in the example, and when I echo my array it looks just fine.

How do I build the array to populate the cc array? Or what am I doing wrong?

PW 3.0.84 WireMailSMTP 0.2.3

Share this post


Link to post
Share on other sites
24 minutes ago, Klenkes said:

But sending fails with the quotes being encoded by PWs sanitizer(I assume)
Invalid email address (&#039;person1@example.com&#039;, &#039;person2@example.com&#039;) (in path_to....\wire\core\WireMail.php line 105)
Why?

Maybe you better should collect an array, and leave it as is?

$address_rev = wire('users')->find("roles=revisor");
$emailcc = array();
foreach($address_rev as $one){ 
	$emailcc[] = one->email
}
$options = array(
    'sendSingle' => true,
    'cc' => $emailcc
);

 

  • Like 2

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.

  • Similar Content

    • By kixe
      Email Verification
      This module provides functions to validate email adresses and hosts. The module generates a textfile for blacklisted mailhosts (trashmail), which will be always up to date.
      Download
      https://modules.processwire.com/modules/email-verification/
      API
      // get module $mailcheck = $modules->get('EmailVerification'); // return bool/ string - automatted update of blacklist file $mailcheck->blacklisted(email|domain) // return bool - validate a top level domain, checks against IANA list $mailcheck->validTLD(tld) // return array of punycoded TLDs - cyclic updated, data pulled from IANA $mailcheck->getTLDs(cycle=2592000) // return bool - checks syntax converts to punycode $mailcheck->validDomainName(domain); // return bool - checks punycode encoded syntax $mailcheck->validHostName(host); // return bool - checks syntax and accessibility $mailcheck->validHost(email|domain) // add a single value to blacklist $mailcheck->addToBlacklist(email|domain) USAGE
      $mailcheck = $modules->get('EmailCheck'); $email = 'susi@trashmail.com'; if($mailcheck->blacklisted($email)) echo 'Email Provider not allowed'; if(!$mailcheck->validHost($email)) echo 'Mailhost not available'; Example blacklist file:  blacklist.txt
       
    • By teppo
      Code Blocks Textformatter is a tiny Textformatter module I cooked up to add support for code blocks to text/textarea/RTE fields on some of the sites I work with. Unlike a full-blown Markdown Textformatter – which is something that we already have in the core – this module simply adds support for fenced and inline code blocks.
      The syntax is based on the GitHub code block documentation, so please refer to that for additional instructions. The README at GitHub also includes some basic examples. As with any Textformatter, in order to enable this one, install it and enable it via field settings. Note that there's no syntax highlighting built in (at least for the time being), so use a tool of your choice for that – personally I prefer Prism.js.
      Since this module doesn't use a Markdown tool behind the scenes, but rather some home baked regular expressions, there's always the possibility that I've missed something – but please let me know if you use this module and run into any issues. On the other hand this module should be relatively fast and unobtrusive, as there are no unnecessary bits of code to run 
      GitHub repository: https://github.com/teppokoivula/TextformatterCodeBlocks Modules directory: http://modules.processwire.com/modules/textformatter-code-blocks/
    • By theo
      Here is my first processwire module (beta).
      https://github.com/theo222/ImagePickerField
      A lot of "first times". First time Github, Markdown and of course PW Modules.
      So be gentle please.
      I hope it works.

    • By horst
      Image Animated GIF  v 2.0.2
       
      Module for PW 2.5 stable or newer, but is obsolete for PW Versions greater then 3.0.89 (... read more ...)
       
      This module helps with resizing and cropping of animated GIFs when using the GD-Library.
      The GD-Library does not support this.


      This module is completely based upon the fantastic work of

         László Zsidi (http://www.gifs.hu/, builts the initial classes)
         xurei (https://github.com/xurei/GIFDecoder_optimized, enhanced the classes)


      I have ported it to a PW module and it works with core imagefields, together with Pia and with CropImagefields that uses the new naming scheme since PW 2.5.
       
      ------------------------------------------------------------------------------------------------------------------------------------------
      read more in this post about the rewrite from version 1.0.0 to version 2.0.0
      ------------------------------------------------------------------------------------------------------------------------------------------
      You can find it in the modules directory: https://modules.processwire.com/modules/image-animated-gif/
      and on Github: https://github.com/horst-n/ImageAnimatedGif
      ------
      A preview can be found here