Jump to content

WireMailSendGrid


guy
 Share

Recommended Posts

Github: https://github.com/theGC/WireMailSendGrid

What it does:

Extend WireMail to bypass PHP mail and send mail via SendGrids Web API.

What you need:

A SendGrid account, use this to generate an API Key with Full Mail Send permissions.

Once installed, the API Key is popped into the modules config and you should be good to go.

Use Cases:

It simplifies the process of sending email from servers by removing the need to configure sendmail or other email routing applications on the server. Instead it relies solely on PHP and offloads the sending to SendGrid which can be heavily configured via its UI to ensure better delivery rates for your domain.

 

  • Like 4
Link to comment
Share on other sites

Hey @guy, thanks for sharing this!

Unless I've missed something important, note that your module doesn't actually have to hook into WireMail::___send() – it's a WireMail module, so it should implement its own ___send() method instead. This is how WireMail modules are designed to work, and it also guarantees proper interoperability in the case that other WireMail modules are installed ?

See WireMailMailgun for a reference.

  • Like 3
Link to comment
Share on other sites

  • 2 months later...

hey @guy

i installed this module and have a free-sendgrid account. generated an API key and did this:

	$m = new wireMail();
	$m->body('hello');
	$m->from($email = 'test@test.com', $name = 'John');
	$m->to($email = 'mail@test.com', $name = 'Jane', $substitutions = null, $subject = 'TESTING');
	$m->___send();

Email is send out and delivered. But i don't see any statistics about them being sent on sendgrid. Did i forgot something?
Tracking is enabled.

Link to comment
Share on other sites

@ngrmm thanks for letting me know about that config issue. Will get that sorted in a min.

On the SendGrid front I'm not too sure. SendGrid should show sent and received stats for all messages, therefore if you're not even seeing that (and the message is delivered) then something else is probably not quite right.

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

Hi Hi, trying to use this module with Snedgrid but seem to be un able to know if the communication is happening... I've set up an account, verified the domain and email address, set up an API key and adding the code as follows but cant seem to get any emails or activity on sendgrid... anything missing or is this module no longer compatible?

$mail = $modules->get('WireMailSendGrid');
$mail->to("******@gmail.com");
$mail->from("site@*********");
$mail->subject("test");
$mail->bodyHTML("hello");
$success = $mail->send();

 

  • Like 1
Link to comment
Share on other sites

3 hours ago, benbyf said:

Hi Hi, trying to use this module with Snedgrid but seem to be un able to know if the communication is happening... I've set up an account, verified the domain and email address, set up an API key and adding the code as follows but cant seem to get any emails or activity on sendgrid... anything missing or is this module no longer compatible?

hey @benbyf, as you see above i had/have same problems. Back then i read something about issues with SSL preventing tracking. 

Link to comment
Share on other sites

Hey @benbyf... I don't know if it's working now within your project... so I'll make it short:

The module is working perfectly fine in my setup which is 10 minutes old and is running on PW 3.0.179.

I just created an API key, limited it to just sending mails, put it in the module config and everything was fine - almost.

The sandbox option prevents sending mails so it needs to be removed.

I don't use any of the other options within the module expect logging.

SendGrid tells you your usage (you fill find that link in the bottom of the sidebar) so you can check if something was sent. Another option is of course this gem here: https://processwire-recipes.com/recipes/logging-outgoing-emails/ (which is in place as well and logged all of my test mails).

  • Like 3
Link to comment
Share on other sites

3 hours ago, wbmnfktr said:

Hey @benbyf... I don't know if it's working now within your project... so I'll make it short:

The module is working perfectly fine in my setup which is 10 minutes old and is running on PW 3.0.179.

I just created an API key, limited it to just sending mails, put it in the module config and everything was fine - almost.

The sandbox option prevents sending mails so it needs to be removed.

I don't use any of the other options within the module expect logging.

SendGrid tells you your usage (you fill find that link in the bottom of the sidebar) so you can check if something was sent. Another option is of course this gem here: https://processwire-recipes.com/recipes/logging-outgoing-emails/ (which is in place as well and logged all of my test mails).

Thanks, I think there was several things, I hadn't verifed the email account properly, I found the PW logs and sorted it out, then found that sendgrid simply isn't logging anything, not a peep... emails are getting sent so i suppose it just takes a while to register on their stats or something but its really strange.

  • Like 1
Link to comment
Share on other sites

On 6/23/2021 at 10:41 PM, benbyf said:

sendgrid simply isn't logging anything, not a peep...

In my case everything was logged as expected. Each and every try was in the logs.

On 6/23/2021 at 10:41 PM, benbyf said:

takes a while to register on their stats

The website was almost on point... maybe a minute or so off but yet... pretty good. Almost too good.

 

But hey... perfect... it's working for you now. Awesome!

 

Short update here:

While SendGrid and the module work as expected I/we moved on using mailjet.de with WireMailSmtp. The project (as in "client") wants and needs to be perfectly fine with DSGVO/GDPR and therefore Mailjet was the better option. As they (client) send quite a huge amount of mails of any kind they were ready to pay one of their standard plans that should fit their needs.

I disabled all tracking, opening and whatever options they offer in the settings as the project should create through all instances only a very small data footprint with as little data as possible. Right now the client and their "data and privacy" consultant are quite happy.

So... if you are within the EU (or have been in there) look at mailjet. 

As Mailgun and Mailjet are somehow one company... I will play with the WireMailMailgun module in the next weeks. Maybe it works.

Edited by wbmnfktr
Update notice: Mailjet
  • Like 2
Link to comment
Share on other sites

  • 1 month later...
On 6/23/2021 at 10:46 PM, wbmnfktr said:

As Mailgun and Mailjet are somehow one company... I will play with the WireMailMailgun module in the next weeks. Maybe it works.

Hi @wbmnfktr, look here: https://dr-dsgvo.de/ist-mailjet-datenschutzkonform-nutzbar/
I don't know if this is a reliable source but sounds legit.

And did it work for you with the WireMailMailgun?

 

  • Like 2
Link to comment
Share on other sites

3 hours ago, ngrmm said:

Hi @wbmnfktr, look here: https://dr-dsgvo.de/ist-mailjet-datenschutzkonform-nutzbar/
I don't know if this is a reliable source but sounds legit.

Ok, that's interesting. Just gave it a quick look and have to look closer into this the next days but... well that could be a dealbreaker. 

3 hours ago, ngrmm said:

And did it work for you with the WireMailMailgun?

Haven't had enough time for that. I just use it with WiremailSmtp and it works pretty well so far. 

  • Like 1
Link to comment
Share on other sites

I am by no means an expert on this area (IANAL etc. ?) but this is worth checking out: https://ec.europa.eu/commission/presscorner/detail/en/ip_21_2847.

While privacy shield is no longer applicable, standard contractual clauses still are. As such, I wouldn't completely rule out a company with non-EU presence. Most email service providers have comprehensive GDPR info available, and most of them also seem to provide a DPA (data processing agreement/addendum) for their clients, at least on request.

Anyway, just my five cents. Of course when in doubt, it's a good idea to consult lawyer. Preferably one with experience in GDPR and Internet privacy ?

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

  • 2 months later...

I just came across this module and I'm just curious how do we send the unsubscribe group ID for this one? Generally, the approach is to add it in the JSON:

{
	asm: {
        group_id: <the unsubscribe group ID>
      }
}

but I checked the modules and there's setCustomArgs, setSection, and I don't know which of these I should put this parameter.

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...