Jump to content

WireMailSmtp


horst

Recommended Posts

  • 1 month later...

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!

Link to comment
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
Link to comment
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 ('person1@example.com', 'person2@example.com') (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

Link to comment
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 ('person1@example.com', 'person2@example.com') (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
Link to comment
Share on other sites

Is there a property to set a "Return-Path:" which differentiates from the "From:" setting? At a first glance, I have found a method call

$this->emailMessage->SetHeader('Return-Path', $address);

inside WireMailSmtpAdaptor.php - I guess this can't be overridden individually?

Link to comment
Share on other sites

You can set a reply-to emailaddress in the config screen. If this isn't what you are after, there is a possibility to add individual headers. 

I'm on mobile now, thus not able to do a search. Can have a closer look later. 

Link to comment
Share on other sites

  • 2 weeks later...

I moved my site over to a new host and am starting to see errors on my contact form which uses FormBuilder and routes via WireMailSMTP

When I submit a form, I receieve the following

Quote

Unable to verify successful email delivery of this form submission.

I wondered if this were a WireMailSMTP issues and tried the Test Settings checkbox

Quote

535 Incorrect authentication data

The thing is, my PostMark App authentication credentials haven't changed in the move.

Just to be sure, I have pasted them in place again with the same result. 

I then tried to create new Server API tokens, hooked these up and had the same error.

I don't believe this is an issue with PostMarkApp (just a hunch) and wondering if anyone had any ideas?

Wondered if it might be an issue with the new host stopping somewhow outgoing connections to PostMarkApp etc?

 

Link to comment
Share on other sites

35 minutes ago, Peter Knight said:

I moved my site over to a new host and am starting to see errors on my contact form which uses FormBuilder and routes via WireMailSMTP

When I submit a form, I receieve the following

I wondered if this were a WireMailSMTP issues and tried the Test Settings checkbox

The thing is, my PostMark App authentication credentials haven't changed in the move.

Just to be sure, I have pasted them in place again with the same result. 

I then tried to create new Server API tokens, hooked these up and had the same error.

I don't believe this is an issue with PostMarkApp (just a hunch) and wondering if anyone had any ideas?

Wondered if it might be an issue with the new host stopping somewhow outgoing connections to PostMarkApp etc?

 

The key thing is that you changed hosts and now are having issues getting mail to work properly.  You need to read up and review how mail is processed at your new hosting company.  After finding out how mail works at the new host, you may have to make a few changes to your WireMailSMTP configuration screen to get things working.  

Additionally, your new hosting company should be able to verify that needed ports are opened (not blocked) for your account.  Good luck.

  • Like 3
Link to comment
Share on other sites

43 minutes ago, cstevensjr said:

The key thing is that you changed hosts and now are having issues getting mail to work properly. 

Solved it. I had just assumed that allowing SMTP processing by 3rd parties was a basic feature of mosts hosts.

Unfortunately my new host (A2 Hosting) actually don't allow this unless you're on a high level plan. :-/

Link to comment
Share on other sites

I am using WireMailSmtp for a project. Interestingly everything worked fine while I used it from localhost but as soon as I deployed to webspace and tried using it from the domain it threw me following error:  "Call to undefined function wire()"

As I was searching for a solution I came to this page :

Now I changed every wire() call to ProcessWire\wire() and it worked. Maybe that should be included in a following update?

If I am wrong please enlighten me. And if that is the case you might as well explain to me what the problem was ^-^

 

Link to comment
Share on other sites

On 1/31/2018 at 11:06 AM, flydev said:

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

Thanks @flydev, credentials were alright, but turned out it was the host that was the problem, site is running on A2. So it's the same problem @Peter Knight ran into.

Link to comment
Share on other sites

1 hour ago, nikoka said:

Thanks @flydev, credentials were alright, but turned out it was the host that was the problem, site is running on A2. So it's the same problem @Peter Knight ran into.

Hi @nikoka

If you're running A2 Hosting on a Lite, Swift or Turbo plan OR Reseller plan then external SMTP servers won't work.

Here's the full support page

I had just started using A2 for my hosting and was about to migrate about 10 sites from a VPS. Really glad I discovered this early when I had just moved the first site.

FYI I moved to Hostinger. I've had a few setup issues but they do allow external SMTP processing. 

 

Link to comment
Share on other sites

  • 1 month later...

Does anybody get it working with Gmail SMTP? 

I always get

could not connect to the host "smtp.gmail.com": Connection refused 

I have tried all possible combinations of settings and ports and double check my credentials. The same thing on localhost and remote hosts. 

Is it something with Gmail? 

--------------------

Get it working on the remote host, ports were closed.

But what can be wrong with the local setup? 

Link to comment
Share on other sites

  • 2 weeks later...

I'm getting the following error when trying to add an attachment and not quite sure why:

Exception: Method WireMailSmtp::attachment  does not exist or is not callable in this context.

Is there any reason for this that anyone knows of?

Link to comment
Share on other sites

@ethanbeyer  here you go:

Should I be doing $mail = $modules->get('WireMailSmtp') or something?

$mail = wireMail();
$mail->to($name);
$mail->from = 'example@example.com';
$mail->subject("Subject Here");
$mail->body("Hello bla bla bla");
$mail->attachment($filepath);

$numSent = $mail->send();

 

Link to comment
Share on other sites

  • 3 weeks later...

Hello, Ive but using the module for a few month now (its great thanks!)

Over the last couple of weeks I have been experiencing problems. Iam using a office 365 exchange account, which just randomly stops sending. If I run the test is setting it fails. After that if I deselect TLS save a then retick TLS save and test it works again. Any ideas what may be causing this?

Link to comment
Share on other sites

@Jon this sounds a little strange. Reading most of your comment, I would think that this might have something to do with your Office365 having sending limits that you're going over. The TLS issue is what makes it weird, though - because if it was a limits problem, that would not be happening.

Is there anything in the logs that gives what error is encountered, rather than saying it just stops sending?

  • Like 2
Link to comment
Share on other sites

  • 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...