Jump to content

WireMailSmtp


horst

Recommended Posts

Just tested and sending via CURL using Postmark's API from a command line it went through fine so I guess it must be the module trimming the .solutions part of the domain unless the server config can also have an effect on emails sent this way?

Link to comment
Share on other sites

  • 1 month later...

Hello, I'm having some trouble using the module inside another module.

It looks like it can't process the "to" email, I'm always getting "Error in hnsmtp::send : it were not specified any valid recipients".

I simply call the module as I call it inside a template

$m =  wireMail();
$m->to($email);
$m->subject('my subject');
$m->bodyHTML($body);
$numSent = $m->send();

I tried to change the call to $this->modules->get('WireMailSmtp') with no success...what I'm doing wrong?

 

Edit: I solved it. Maybe it could be helpful for someone else...the send email address in the general setting of the module was wrong (different domain from the one set in the smpt) and somehow it didn't show any error when Wiremail sends an email from a template..

Link to comment
Share on other sites

  • 2 months later...

I've been encountering frequent Error in hnsmtp::send : cannot connect to smtp-server! errors indicating a failure to connect to the SMTP server. I'm using Brevo, formerly known as SendinBlue, and this issue only started a few months ago. The errors seem to occur randomly, with varying frequency, ranging from ten times a day to once a week. I've reached out to Brevo for assistance, but they haven't identified any issues so far.

Additionally, I recently conducted an external SMTP test on dnschecker.org, and it consistently succeeded each time (though this might be coincidental). The problem persists regardless of whether I test the connection locally or in a live environment.

I'm wondering if there's a way to debug the SMTP connection to gather more information about the problem.

  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...
On 8/14/2023 at 6:00 AM, Pete said:

Just tested and sending via CURL using Postmark's API from a command line it went through fine so I guess it must be the module trimming the .solutions part of the domain unless the server config can also have an effect on emails sent this way?

Also having this same issue and digging through the module to find a solution. Did you happen to find a better solution than using the curl command?

Link to comment
Share on other sites

51 minutes ago, Jason Spooner said:

Also having this same issue and digging through the module to find a solution. Did you happen to find a better solution than using the curl command?

Found this in the module and needs to be fixed:

var $email_address_pattern="([-!#\$%&'*+./0-9=?A-Z^_`a-z{|}~])+@([-!#\$%&'*+/0-9=?A-Z^_`a-z{|}~]+\\.)+[a-zA-Z]{2,6}";

  • Thanks 1
Link to comment
Share on other sites

@horst the regex mentioned above does appear to be faulty as it only allows domain endings up to 6 characters whereas this discussion suggests an upper limit of 63 (though nobody has created one that long yet to my knowledge). I would just go for 2,24 for now to keep it relatively sensible as the longest currently is 24, or you could just make it 2,63 to future-proof it a bit?

Source: https://stackoverflow.com/a/22038535

  • Thanks 1
Link to comment
Share on other sites

  • 4 weeks later...
  • 3 weeks later...

Hello everyone,
does anyone have experience with All-Inkl.com?

Somehow I can't get it set up correctly. My settings can be seen on the screenshot.

When I test the settings I get the following:

 

array(1) 
{
  ["SETTINGS"]                       array(28) 
  {
    ["default_charset"]              string(5) "UTF-8"
    ["localhost"]                    string(10) "fgfc820.de"
    ["smtp_host"]                    string(21) "v075199.kasserver.com"
    ["smtp_port"]                    int(465)
    ["smtp_ssl"]                     int(1)
    ["smtp_ssl_crypto_method"]       string(0) ""
    ["smtp_start_tls"]               int(1)
    ["smtp_tls_crypto_method"]       string(1) "0"
    ["smtp_user"]                    string(15) "page@fgfc820.de"
    ["smtp_password"]                string(20) "---MyPassword---"
    ["smtp_password2"]               string(0) ""
    ["clear_smtp_password"]          string(0) ""
    ["allow_without_authentication"] string(0) ""
    ["realm"]                        string(0) ""
    ["workstation"]                  string(0) ""
    ["authentication_mechanism"]     string(0) ""
    ["smtp_debug"]                   int(0)
    ["smtp_html_debug"]              int(0)
    ["sender_name"]                  string(12) "Kilian Spohr"
    ["sender_email"]                 string(15) "page@fgfc820.de"
    ["sender_reply"]                 string(0) ""
    ["sender_errors_to"]             string(0) ""
    ["sender_signature"]             string(0) ""
    ["sender_signature_html"]        string(0) ""
    ["send_sender_signature"]        string(0) ""
    ["extra_headers"]                array(0) 
    {
    }
    ["valid_recipients"]             array(0) 
    {
    }
    ["smtp_certificate"]             int(1)
  }
}
array(1) 
{
  ["RESULT"]             array(5) 
  {
    ["subject"]          string(9) "Test Mail"
    ["addSignature"]     string(1) "0"
    ["textbody"]         string(39) "This is a test message. ÄÖÜ äöüß"
    ["recipients"]       array(1) 
    {
      [0]                array(3) 
      {
        ["emailaddress"] string(18) "kilianspohr@web.de"
        ["name"]         string(0) ""
        ["type"]         string(2) "to"
      }
    }
    ["send"]             string(0) ""
  }
}
array(1) 
{
  ["ERRORS"] array(1) 
  {
    [0]      string(36) "server does not support starting TLS"
  }
}
array(1) 
{
  ["DEBUGLOG"] string(548) "

Resolving SMTP server domain "v075199.kasserver.com"...
Connecting to SMTP server "v075199.kasserver.com" port 465...
Connected to SMTP server "v075199.kasserver.com".
S 220 dd48224.kasserver.com ESMTP
C EHLO fgfc820.de
S 250-dd48224.kasserver.com
S 250-PIPELINING
S 250-SIZE 102400000
S 250-VRFY
S 250-ETRN
S 250-AUTH PLAIN LOGIN
S 250-AUTH=PLAIN LOGIN
S 250-ENHANCEDSTATUSCODES
S 250-8BITMIME
S 250-DSN
S 250 CHUNKING
"
}

Does anyone have an idea why this might be?

Sending emails via Thunderbird works

Thank you

Screenshot 2024-01-25 at 12-04-59 Module Wire Mail SMTP • fgfc820.de.png

Link to comment
Share on other sites

You have entered a few small details incorrectly ? 

Use Port 587, Uncheck "use SSL" and then "Select a crypto method for TLS" (for Example STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT)

And change the SMTP User to your Mail USERNAME, not your Email Address (you can find this info in the All-Inkl KAS -> Edit the Mailbox).

  • Like 1
  • Thanks 2
Link to comment
Share on other sites

16 minutes ago, zoeck said:

You have entered a few small details incorrectly ? 

Use Port 587, Uncheck "use SSL" and then "Select a crypto method for TLS" (for Example STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT)

And change the SMTP User to your Mail USERNAME, not your Email Address (you can find this info in the All-Inkl KAS -> Edit the Mailbox).

Thank you, it works now.

But it's strange, for thunderbird or other mail programs I had to use the Port 465 and I could use the mail address as username. In their faq they also wrote Port 465.

Link to comment
Share on other sites

3 hours ago, ShadowByte said:

But it's strange, for thunderbird or other mail programs I had to use the Port 465 and I could use the mail address as username. In their faq they also wrote Port 465.

I think Both is possible ? Port 465 is the SSL Port.

All Inkl FAQ:

Quote

If you use STARTTLS as connection security, enter port 25 or 587. When using SSL/TLS, port 465 applies.

The Mail address as username also works (mostly), but I have had problems with it before, so I always recommend using the username.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...
Posted (edited)

Hello @All

I got a problem. Latest PW, same PHP 8.1

When sending from Localhost everything is working fine. When sending from my website I got "Connection refused". Error log:

module/edit?name=WireMailSmtp&collapse_info=1	Error in hnsmtp::send : cannot connect to smtp-server!

I've tried to change Hostname of this computer but no luck. 

Using smtp.zoho.com, port 465, SSL checked

Edited by Leftfield
Link to comment
Share on other sites

Yes @wbmnfktr (now I count bottles of whiskey I own you), I am on my mobile, waited to come home to sit down by the computer to post here, but you posted before me.

In the end, I found out it was my server blocking the outgoing SMTP connection. The module is working great! Still waiting the host to unlock it. 

  • Haha 1
Link to comment
Share on other sites

  • 1 month later...

Does anyone have a fix for the following error which appears when using the "Test settings" function?

Class "ProcessWire\WireMailSmtp" not found

(at site/modules/WireMailSmtp/WireMailSmtpAdaptor.php:145)

I'm using ProcessWire 3.0.229

Or is there an alternative plugin to send smtp mails on modern PW systems?

Link to comment
Share on other sites

Running that test in WireMailSmtp 0.6.4 with ProcessWire 3.0.240 on PHP 8.2 doesn't throw any errors here.

Don't have a 3.0.229 at hand right now to test it with.

What WireMailSmtp and PHP version are you running?

Link to comment
Share on other sites

  • 1 month later...

Minor request. Is it possible to use the 'test' function when wireMailRouter is installed? I get "Couldn't get the right WireMail-Module (WireMailSmtp). found: WireMailRouter"

If I set $config->wireMail('module', 'WireMailSmtp'); temporarily then it works, but I wonder if it is possible for the module to supply that as an override when testing?

  • Like 1
Link to comment
Share on other sites

On 9/7/2024 at 1:56 AM, wbmnfktr said:

Wouldn't that mean that your test resulted in WireMailRouter took care of that test and ignored WireMailSmtp?

WireMailRouter was set to use WireMailSmtp as primary method, but (if a from and to is specified in verbose settings) WireMailSmtp ignores the test attempt if it is not the WireMail class name:

                $mail = wireMail();
                if($mail->className != 'WireMailSmtp') {
                    $dump = "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>";
                } else {

So basically the full test will not work if WireMailRouter is installed - only the plain connection test. My suggestions are:

  1. The config screen should make it clear that verbose debug settings will not work if WireMailSmtp is not the WireMail class and need to be empty to test the connection only, or
  2. that the test should temporarily set the WireMail class to be WireMailSmtp - something like: 
                if($from && $to) {
                    // do a verbose debugging
                    if(!$subject) $subject = 'Debug Testmail';
                    if(!$body) $body = 'Debug Testmail, äöüß';
                    $mail = wireMail();
                    $dump = '';
                    if($mail->className != 'WireMailSmtp') {
                        $wireMailClass = $mail->className;
                        $this->config->wireMail('module', 'WireMailSmtp');
                        $mail = wireMail();
                        $dump .= "<p>Currently installed WireMail class is $wireMailClass. Testing with WireMailSmtp, then reverting to $wireMailClass.</p>";
                    }
                    $mail->from = $from;
                    $mail->to($to);
                    $mail->subject($subject);
                    $mail->sendSingle(true);
                    $mail->body($body);
                    $dump .= $mail->debugSend(3);
                    if(isset($wireMailClass)) $this->config->wireMail('module', $wireMailClass);
                } else {
                    // only try a testconnection

     

Personally I'm more inclined to (2), but does anyone else have a view?

  • Like 1
Link to comment
Share on other sites

On 9/8/2024 at 11:41 AM, MarkE said:
                $mail = wireMail();
                if($mail->className != 'WireMailSmtp') {

Hi, I don't have WireMailRouter and therefor don't know how it works together.
But please can you (or @Ivan Gretsky or @wbmnfktr, who seems to have it too, like you) simply test the following OneLineChange in the WireMailSmtp-Testfunction?  

    $mail = wireMail();
    if ($mail->className != 'WireMailSmtp' && $mail->className != 'WireMailRouter) {
....

It then will skip the abort. So, don't know if it then works like it should, but that's why I ask for the test. 🙂

Let me know if someone can do that, and if so, what was the result.
Greetings! 🙋‍♂️

Link to comment
Share on other sites

3 hours ago, horst said:

Let me know if someone can do that, and if so, what was the result.

I'll do that later this evening @horst. However, the reason I chose to make the change I did, rather than the one you suggest, is because different mail modules permit slightly different methods so the WireMailSmtp methods may not work without changing the class. Also, my suggestion will work as a standalone test of WireMailSmtp even if the current class is something completely different (e.g. WireMailMailgun) and the developer is using a different method from WireMailRouter to switch classes.

  • Like 2
Link to comment
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
×
×
  • Create New...