Comments (22)
Thank you for the update and the code sample. Until the API changes, it might be worth throwing an exception if a web API call contains a CC or a BCC. There's no way a user would be able to figure this restriction out on their own.
from sendgrid-php.
Ok, so this is actually by design with the way the our Web API works. I've talked to our team and it might be something we change in the future. Until then, you will have to go through our smtp library for this. You can do it using swiftmailer - http://swiftmailer.org/ - and this bit of example code:
<?php
require 'vendor/autoload.php';
Dotenv::load(__DIR__);
$sendgrid_username = $_ENV['SENDGRID_USERNAME'];
$sendgrid_password = $_ENV['SENDGRID_PASSWORD'];
$to = $_ENV['TO'];
$transport = Swift_SmtpTransport::newInstance('smtp.sendgrid.net', 587);
$transport->setUsername($sendgrid_username);
$transport->setPassword($sendgrid_password);
$mailer = Swift_Mailer::newInstance($transport);
$message = new Swift_Message();
$message->setTo($to);
$message->setCc("[email protected]");
$message->addBcc("[email protected]");
$message->setFrom($to);
$message->setSubject("[smtp-php-example] Owl named %yourname%");
$message->setBody("%how% are you doing?");
$header = new Smtpapi\Header();
$header->addSubstitution("%yourname%", array("Mr. Owl"));
$header->addSubstitution("%how%", array("Owl"));
$message_headers = $message->getHeaders();
$message_headers->addTextHeader("x-smtpapi", $header->jsonString());
try {
$response = $mailer->send($message);
print_r($response);
} catch(\Swift_TransportException $e) {
print_r($e);
print_r('Bad username / password');
}
from sendgrid-php.
I was just bitten by this as well. I'd suggest removing the methods from your interface or have them throw an exception as suggested above. Very confusing that this doesn't work as you would expect, especially for something that seems trivial like 'cc'.
from sendgrid-php.
This is a very good idea.
from sendgrid-php.
Hi scott
I am unable to run the above file because it gives me an error Fatal error: Class 'Dotenv' not found.
And can you please specify in detail what all i need to run a sendgrid email. I downloaded all your github files and i am confused on how to use them
from sendgrid-php.
Hi @prashanthpanyam - take a look here for some working code examples:
https://github.com/sendgrid/sendgrid-php-example
But otherwise, if you follow the readme here:
https://github.com/sendgrid/sendgrid-php#installation
everything should work ok.
Don't use the example in this issue. It had to do with a different issue.
from sendgrid-php.
Yes I used the same example specified in the first link and followed the installation as in 2nd link.
But the error still persists saying Fatal error: Class 'Dotenv' not found in D:\xampp\htdocs\sendgrid-php\smtp-php-example.php on line 3.
So what should the solution be
Thanks & Regards
Prashanth
From: Scott Motte [mailto:[email protected]]
Sent: Thursday, May 08, 2014 11:31 PM
To: sendgrid/sendgrid-php
Cc: prashanthpanyam
Subject: Re: [sendgrid-php] CC and BCC not working (#83)
Hi @prashanthpanyam https://github.com/prashanthpanyam - take a look here for some working code examples:
https://github.com/sendgrid/sendgrid-php-example
But otherwise, if you follow the readme here:
https://github.com/sendgrid/sendgrid-php#installation
everything should work ok.
Don't use the example in this issue. It had to do with a different issue.
—
Reply to this email directly or view #83 (comment) it on GitHub. https://github.com/notifications/beacon/7523943__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxNTE5MTIzNCwiZGF0YSI6eyJpZCI6MjgxNTY5NTN9fQ==--c2aacca04cc5954856ab519577a75e53a7a4cb7d.gif
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
from sendgrid-php.
Hi @prashanthpanyam,
The example library is slightly different than the standard install. If using the sendgrid-php-example, you need to run composer. Are you doing that here:
https://github.com/sendgrid/sendgrid-php-example#usage
There's a command composer install
. That will install all the dependencies - one of which is the Dotenv dependency that you are currently missing.
BUT, Dotenv is not required for the standard install - it's just part of the example for convenience.
from sendgrid-php.
We're experiencing similar issues.
from sendgrid-php.
Just wanted to add, it's strange that BCC isn't working especially since it exists as a method in your class. Please make the proper adjustments to let other users know, as soon as possible.
from sendgrid-php.
+1
from sendgrid-php.
I have to say, I ran into this again. While I "kinda" understand why you would get rid of Bcc, removing CC is slightly outrageous. In my line of work we have to send messages to entire teams of people, how are we supposed to achieve that without CC? And no, advising me to use yet another library / implementation is not acceptable.
from sendgrid-php.
This will be fixed in the upcoming v3.0.0 branch. We will be defaulting to
a web parameter for 'to' as opposed to the current usage of the smtpapi
header for 'to'.
On Monday, January 26, 2015, Serg Chernata [email protected] wrote:
I have to say, I ran into this again. While I "kinda" understand why you
would get rid of Bcc, removing CC is slightly outrageous. In my line of
work we have to send messages to entire teams of people, how are we
supposed to achieve that without CC? And no, advising me to use yet another
library / implementation is not acceptable.—
Reply to this email directly or view it on GitHub
#83 (comment)
.
Eddie Zaneski
{"device": "mobile"}
from sendgrid-php.
Thanks for the quick response. If you get a chance, please let us know when that happens.
from sendgrid-php.
Just had everything setup and working nicely - my class setup, email formatted and bang... ->setBcc - with addTo or CC not working. What a big disappointment.
I went to your Github page, scrolled down to see it listed there as part of the documentation and scratched my head many times until I found this topic.
You really need to make it clear that this doesn't work with your php lib. I basically made my choice on this lib because of that.
It's been a year since this issue was put up - any news on progress on this?
Thanks a lot.
from sendgrid-php.
I am actively working on this on the 3.0.0 branch. It will be done very very shortly. So sorry for the delay.
from sendgrid-php.
I hit this one hard as well. Much time spent tracking down this bug. Thumbs up lanching version 3 as soon as possible.
from sendgrid-php.
Working on implementing BCC on SendGrid in another application of ours and having experienced this issue, I'd love to use the actual BCC function rather than a work-around if possible. Any ETA on the 3.0.0 branch?
from sendgrid-php.
I have a pre-release up of v3.0.0 that should fix all of these issues. Would love some testers to provide feedback.
I need to write up the changes and a better README, but here's a primer.
"sendgrid/sendgrid": "3.0.0-RC1"
in composer.
https://github.com/sendgrid/sendgrid-php/releases/tag/v3.0.0-RC1
from sendgrid-php.
One of our developers (@animir) is currently testing this. /cc @animir
from sendgrid-php.
Is the new version the one used by parse's cloud module? Because there it does not seem to work.
from sendgrid-php.
@odrobnik I don't know which version Parse is using in their cloud module. I suggest you contact their support team. Thanks.
from sendgrid-php.
Related Issues (20)
- Sendgrid php library incompatible with PHP 8.1 HOT 4
- "$emailAddress" must be a valid email address. Got: [email protected] HOT 1
- php 8.0
- message":"Permission denied, wrong credentials HOT 1
- Subscribe to email notifications link broken/dx.sendgrid.com not working HOT 1
- Personalization missing functions HOT 3
- Corrupted 7.11.4 release zip file HOT 1
- Latest release .zip corrupt, SendGrid not compatible with PHP 8 HOT 1
- AWS error when try import contacts csv HOT 1
- Header and footer dynamic templates [FEATURE] HOT 1
- Is V3 reply_to_list implemented in sendgrid-php? HOT 3
- Insecure Inbound Parse
- Feature request: Marketing Campaigns - Delete category
- Class 'SendGrid\Mail\Mail' not found in Codeigniter 4 application HOT 1
- Create contact API (https://api.sendgrid.com/v3/marketing/contacts) returns no response when called using PHP curl
- Is there a function for setSendEachAt
- Code and/or files that need upgrading to work on PHP 8.0 ini HOT 3
- Deprecated Property Warnings in EventWebhook Signature Verification with PHP 8.2 HOT 1
- Adding users to a list via PHP
- Error in example: Send Multiple Emails with Personalizations
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sendgrid-php.