Giter Site home page Giter Site logo

Comments (22)

lexicalbits avatar lexicalbits commented on July 28, 2024 2

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.

motdotla avatar motdotla commented on July 28, 2024 1

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.

mgodwin avatar mgodwin commented on July 28, 2024 1

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.

motdotla avatar motdotla commented on July 28, 2024

This is a very good idea.

from sendgrid-php.

prashanthpanyam avatar prashanthpanyam commented on July 28, 2024

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.

motdotla avatar motdotla commented on July 28, 2024

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.

prashanthpanyam avatar prashanthpanyam commented on July 28, 2024

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.

motdotla avatar motdotla commented on July 28, 2024

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.

jamesspittal avatar jamesspittal commented on July 28, 2024

We're experiencing similar issues.

from sendgrid-php.

sergchernata avatar sergchernata commented on July 28, 2024

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.

jlank avatar jlank commented on July 28, 2024

+1

from sendgrid-php.

sergchernata avatar sergchernata commented on July 28, 2024

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.

eddiezane avatar eddiezane commented on July 28, 2024

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.

sergchernata avatar sergchernata commented on July 28, 2024

Thanks for the quick response. If you get a chance, please let us know when that happens.

from sendgrid-php.

spandadk avatar spandadk commented on July 28, 2024

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.

eddiezane avatar eddiezane commented on July 28, 2024

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.

srm80 avatar srm80 commented on July 28, 2024

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.

jamesspittal avatar jamesspittal commented on July 28, 2024

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.

eddiezane avatar eddiezane commented on July 28, 2024

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.

jamesspittal avatar jamesspittal commented on July 28, 2024

One of our developers (@animir) is currently testing this. /cc @animir

from sendgrid-php.

odrobnik avatar odrobnik commented on July 28, 2024

Is the new version the one used by parse's cloud module? Because there it does not seem to work.

from sendgrid-php.

thinkingserious avatar thinkingserious commented on July 28, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.