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 2
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

2 minutes ago, 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.

2 minutes ago, 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!

 

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