taz77 / sendgrid-php-ng Goto Github PK
View Code? Open in Web Editor NEWSendgrid PHP API Next Generation
Sendgrid PHP API Next Generation
Errors displayed by V2.0.5 with PHP 8.1
Deprecated function: Return type of SendGrid\Mail\Mail::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 22 of /mnt/wsl/PHYSICALDRIVE0p1/www/unctad/target/vendor/fastglass/sendgrid/src/Mail/Mail.php).
Deprecated function: Return type of SendGrid\Mail\Personalization::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 22 of /mnt/wsl/PHYSICALDRIVE0p1/www/unctad/target/vendor/fastglass/sendgrid/src/Mail/Personalization.php).
Deprecated function: Return type of SendGrid\Mail\SandBoxMode::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 18 of /mnt/wsl/PHYSICALDRIVE0p1/www/unctad/target/vendor/fastglass/sendgrid/src/Mail/SandBoxMode.php).
Deprecated function: Return type of SendGrid\Mail\Category::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 17 of /mnt/wsl/PHYSICALDRIVE0p1/www/unctad/target/vendor/fastglass/sendgrid/src/Mail/Category.php).
Deprecated function: Return type of SendGrid\Mail\Subject::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 17 of /mnt/wsl/PHYSICALDRIVE0p1/www/unctad/target/vendor/fastglass/sendgrid/src/Mail/Subject.php).
Deprecated function: Return type of SendGrid\Mail\EmailAddress::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 18 of /mnt/wsl/PHYSICALDRIVE0p1/www/unctad/target/vendor/fastglass/sendgrid/src/Mail/EmailAddress.php).
Deprecated function: Return type of SendGrid\Mail\Content::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 17 of /mnt/wsl/PHYSICALDRIVE0p1/www/unctad/target/vendor/fastglass/sendgrid/src/Mail/Content.php).
Deprecated function: Return type of SendGrid\Mail\Attachment::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 18 of /mnt/wsl/PHYSICALDRIVE0p1/www/unctad/target/vendor/fastglass/sendgrid/src/Mail/Attachment.php).
Deprecated function: Return type of SendGrid\Mail\TrackingSettings::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 17 of /mnt/wsl/PHYSICALDRIVE0p1/www/unctad/target/vendor/fastglass/sendgrid/src/Mail/TrackingSettings.php).
Deprecated function: Return type of SendGrid\Mail\ClickTracking::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 18 of /mnt/wsl/PHYSICALDRIVE0p1/www/unctad/target/vendor/fastglass/sendgrid/src/Mail/ClickTracking.php).
Deprecated function: Return type of SendGrid\Mail\OpenTracking::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 22 of /mnt/wsl/PHYSICALDRIVE0p1/www/unctad/target/vendor/fastglass/sendgrid/src/Mail/OpenTracking.php).
At Email.php on setTemplateId function (after looking on sendgrid smtp api)
public function setTemplateId($templateId) {
$this->addFilter('templates', 'enabled', 1);
$this->addFilter('templates', 'template_id', $templateId);
return $this;
}
I believe that should be "enable" and not "enabled".
Couldn't find this anywhere (probably just missed it while looking through the code)...how do I pass a username/password to the Client instead of an api key? Can I do this and pass an options array? Has this been taken out? Sorry if the answer is obvious, thanks for the help!
Hello, after trying sendgrid/sendgrid i would like to try this library but i can't get it to work. I've installed it with composer require fastglass/sendgrid
and it installed just fine. But when running one of your examples it just breaks with this error:
Fatal error: Class 'SendGrid' not found in /srv/http/test/sendgrid-test.php on line 5
I have the needed require statement for vendor. Is there anything i've missed? Does this only work with Drupal?
Currently, the ClientException class being caught in Client::postRequest
method is referenced as:
GuzzleHttp\Exception\ClientException
, which is not the correct namespace.
This needs to be either \GuzzleHttp\Exception\ClientException
or simply ClientException
(to take advantage of the already present use GuzzleHttp\Exception\ClientException
statement.
When I add a template_id it gets posted to SendGrid but SendGrid blocks it from being sent out.
I am getting this:
"This email was not sent because the SMTPAPI header was invalid."
Doesn't really say what is invalid. If I don't include the template_id, the email is sent ok.
Anyone else have this issue?
Update code for V3 changes.
Hi Brady,
Could you please give me a clue on how I can set the 'Content-Type'.
I'm migrating to Sendgrid, the previous function I used is:
mail('[email protected]', 'Example 001', 'Content example', "From: GoldMine WebImport <[email protected]>\r\nContent-Type: text/x-gm-impdata\r\n" )
I tried this configuration with sendgrid and the data for CRM import does not work for me.
$email ->addTo('[email protected]') ->addHeader('Content-Type', 'text/x-gm-impdata') ->setFrom('GoldMine WebImport <[email protected]>') ->setSubject('Example 001') ->setText($Body); $sendgrid->send($email);
Regards
Roll minor version for incorrect exception class being caught.
Support all of the Template API calls.
https://sendgrid.com/docs/API_Reference/Web_API_v3/Transactional_Templates/index.html
Thanks for writing/maintaining this library!
As far as I can tell, it currently doesn't support Sendgrid's marketing API (adding/removing contacts, managing lists, etc.). Are there plans to add support for that in the future, or will this library stay focused on sending transactional email?
Force Composer to load the version of Guzzle which has addressed CVE-2016-5385
PHP7.2 is more strict with count().
Line 939, 1037, and 1080 use count. Check to make sure the variable being counted is an array or object and not null.
SendGrid has an official repository using the same PHP namespace as this repo (SendGrid). I've seen the history and understand that they come from the same provenance, but the scope of functionality of the two libraries has diverged. While this package currently represents itself to composer users as a replacement for sendgrid/sendgrid-php, that's misleading as the interface for each is different.
So that users can access both libraries alongside one another easily (without having to maintain a fork of either), I suggest modifying the PSR-4 namespace of this repo. Fastglass/SendGrid
seems appropriate to me, as it matches the composer namespace. Here's my first attempt (master...rtblair:master). Happy to submit a PR if you're interested.
Unit tests are throwing deprecation warnings due to each() being used that will be removed after PHP 7.2.
PSR-4 makes for a simpler file structure. Change the library to use PSR-4 from PSR-0.
Need examples and updated documentation for V3 API
Currently, when a Guzzle ClientException is encountered, the postRequest
method outputs an error message and the var_dumps the entire exception.
The exception contains the Request object as well, which itself contains the bearer token for auth to SendGrid. This is a security vulnerability since it exposes the token.
This code never ran previously due to #24 but it will need to be addressed alongside it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.