Page 1 of 2
SendGrid with Jiwa 

Posted:
Mon Aug 10, 2020 10:08 am
by SBarnes
Recently someone asked about the possibility of using SendGrid with Jiwa, attached is a copy of a plugin that will achieve this and works similar to the ones provided by Jiwa, all you need to do is provide the necessary API Key in the system settings.
The reason I ended up doing this is because I discovered an issue with trying to use the Outlook one inside a windows service such as the Rest API or the Scheduled Plugin Service even if the service is run as a given user in that it can't start Outlook, I am not sure if this is a one off problem to my machine or not.
Anyway the SendGrid one works with both, bear in mind that the normal security for approved senders under SendGrid still apply.
Re: SendGrid with Jiwa

Posted:
Mon Aug 10, 2020 2:12 pm
by Mike.Sheen
SBarnes wrote:I discovered an issue with trying to use the Outlook one inside a windows service such as the Rest API or the Scheduled Plugin Service even if the service is run as a given user in that it can't start Outlook, I am not sure if this is a one off problem to my machine or not.
You're not supposed to use the Outlook API from services - it *might* work, but it is unsupported.
For this reason we are adding the ability to specify per user which email mechanism to use - so services can use things like Sendgrid or the Microsoft Graph API, and other users can use Outlook. We've got a plugin which fills this need on
this post.
Re: SendGrid with Jiwa

Posted:
Mon Aug 10, 2020 2:24 pm
by SBarnes
If you are looking at this area the one thing I did notice with SendGrid because it only has async calls is Jiwa finishes the job of writing to the email call log before the call returns on some occasions which can be an issue if the call fails, I couldn't find a way to get around it that worked with Jiwa either not throwing other errors or SendGrid behaving properly and actually sending the email.
Re: SendGrid with Jiwa

Posted:
Thu Aug 27, 2020 10:09 am
by SBarnes
Hi Mike,
attached is an upgraded version of multiple email providers plugin with SendGrid added that will also work with 7.2.1
When this functionality becomes standard will there be a way to register extra providers?
Re: SendGrid with Jiwa

Posted:
Thu Aug 27, 2020 1:53 pm
by Mike.Sheen
SBarnes wrote:When this functionality becomes standard will there be a way to register extra providers?
Yes, a plugin will just need to have a class implementing the IEmailProvider interface, and in the ApplicationManager plugin add the provider to the list of the registered providers - exactly like in the provided sample.
Re: SendGrid with Jiwa

Posted:
Thu Aug 27, 2020 1:56 pm
by SBarnes
Hi Mike,
I fudged letting the Application plugin to save the manager in a static variable to use for looking up settings given the instance is gone, would it be possible for IEmailProvider to have a manager property that gets hooked up?
Re: SendGrid with Jiwa

Posted:
Wed Jul 27, 2022 5:16 pm
by Mike.Sheen
Updated plugin to be safe to use with REST API enabled.
This fixes an issue where an error "Add failed. Duplicate key value supplied." would be reported when authenticating via the REST API with this Multiple Email Providers plugin enabled also.
Re: SendGrid with Jiwa

Posted:
Wed Aug 03, 2022 6:55 pm
by DannyC
I've found an error with the 7.2.1.1 plugin version to deal with the REST API.
I wondered why SMTP would no longer authenticate to the SMTP mail server.
Much testing & I discovered that the
- Code: Select all
decryptedSMTPPassword = encryptionObject.DecryptString(Manager.Staff.SMTPPassword, Manager.Database.FormatDateTime(Manager.Staff.SMTPPasswordLastChangedDateTime, true));
is returning a string "ERROR". So the SMTP server thinks that the password is ERROR.
This is about line 425?
Anyway I have added in a
- Code: Select all
decryptedSMTPPassword = "myProperPassword"
just under so that I know it's getting the correct p/w.
Re: SendGrid with Jiwa

Posted:
Wed Aug 03, 2022 6:59 pm
by Mike.Sheen
If you just change / set the SMTP password password for that staff member and save it, does this resolve the issue?
If it does then something set either the SMTPPasswordLastChangedDateTime or the SMTPPassword via a direct table update, which would explain the "ERROR" coming back from DecryptString.
Re: SendGrid with Jiwa

Posted:
Wed Aug 03, 2022 7:35 pm
by DannyC
If you just change / set the SMTP password password for that staff member and save it, does this resolve the issue?
Nope. Reset the SMTP password plenty of times thinking that it was wrong.