Comments (16)
Update: I figured it out. I had my yahoo address set up in my gmail settings under "Send mail as"! So gmail was seeing that and used my gmail account instead.
Thanks for the help.
from sendgrid-ruby.
Hello @coderdave,
Could you please provide us with a code snippet so we can try to reproduce?
Also, this library will be replaced by the new version in a few weeks, you can check it out here: https://github.com/sendgrid/sendgrid-ruby/tree/v3beta
With Best Regards,
Elmer
from sendgrid-ruby.
I'm just setting up a basic hash. I would like to send from [email protected] but let them "reply_to" a different address, but it doesn't work. (Also the from_name isn't work either)
def send_it
# send from [email protected] if it's coming from a yahoo.com account :(
from = self.from.include?("@yahoo.com") ? "[email protected]" : self.from
email = {
from: from,
from_name: self.from_name, # sendgrid isn't using the name set here, it uses the from email address
reply_to: self.from, # no affect
to: self.to.split(",").uniq,
bcc: self.bcc.present? ? self.bcc.split(",").uniq : nil,
subject: self.subject,
text: strip_tags(self.message),
html: self.message
}
MailerJob.new.async.perform("SendgridMailer", nil, email)
end
from sendgrid-ruby.
Hello @coderdave,
Thanks for the additional information.
Where are you setting up the SendGrid::Mail object? In the MailerJob? If so, can I take a look at that code?
Thanks!
Elmer
from sendgrid-ruby.
sendgrid = SendGrid::Client.new do |c|
c.api_key = ENV["SENDGRID_APIKEY"]
end
email = arg
sendgrid.send email
from sendgrid-ruby.
email
needs to be a SendGrid::Mail
object. Please see: https://github.com/sendgrid/sendgrid-ruby#usage
from sendgrid-ruby.
Ah, ok, I'll try that. Thanks.
from sendgrid-ruby.
Thanks! Please let us know how it goes.
from sendgrid-ruby.
I finally got around to upgrading to v3. When I tested using reply_to, it still doesn't work.
mail.reply_to = SendGrid::Email.new(email: '[email protected]')
I get the email (to my gmail account) which is fine (and the custom name works) but when I try to reply to the email, it doesn't respect the reply_to I set up. It uses the regular reply email address that I used.
Is there something else I need to set?
from sendgrid-ruby.
Before you make the call to API
, could you please provide the output of:
puts JSON.pretty_generate(mail.to_json)
from sendgrid-ruby.
[43] pry(main)> puts JSON.pretty_generate(mail.to_json)
{
"from": {
"email": "[email protected]",
"name": "bing bong berry"
},
"subject": "hopefully can reply to",
"personalizations": [
{
"to": [
{
"email": "[email protected]"
}
]
}
],
"content": [
{
"type": "text/plain",
"value": "Hello, Email!"
}
],
"reply_to": {
"email": "[email protected]",
"name": "bing bong berry"
}
}
from sendgrid-ruby.
Please try putting that payload in a file named post.json
and run the following (after substituting your API key):
curl -X "POST" "https://api.sendgrid.com/v3/mail/send" \
-H "Authorization: Bearer $SENDGRID_API_KEY" \
-H "Content-Type: application/json" \
-d @post.json
from sendgrid-ruby.
Same effect, email went through but it replies to "[email protected]"
from sendgrid-ruby.
Hmm, I can not reproduce the error with Gmail as the client. Do you mind sharing the raw headers of the email you receive in Gmail?
from sendgrid-ruby.
Ok, I see what's going on. It looks like the reply-to is being set but unfortunately, gmail doesn't respect it. That's too bad. Are there any workarounds for that?
And it's strange that when I reply, it replies to my gmail account, not the [email protected] one.
from sendgrid-ruby.
Thanks for following up with your solution!
from sendgrid-ruby.
Related Issues (20)
- Duplicate checking when adding email to personalization is not accurate HOT 6
- Request: Make it possible to pass http_options config when initialize API HOT 1
- Ruby 3 support HOT 2
- Is sendgrid-ruby still ruby 2.2. compatible? HOT 2
- Unable to verify signature for testing purposes HOT 6
- [BUG] Filter all messages does not work as described in documentation HOT 5
- How to add/remove contacts to a list via new marketing API? HOT 5
- Adding SendGrid addon on Heroku uses Basic Authentication with Username and Password HOT 4
- How to substitute \n or carriage returns HOT 1
- SendGrid::DuplicatePersonalizationError HOT 1
- BaseInterface class should be inside a module HOT 1
- Bad username / password HOT 5
- EML files turning into multiple attachments when using Inbound Parse HOT 5
- Personalization causes duplicate `to` email and sometimes causes multiple emails HOT 1
- Dynamic Templates overwritting list styles HOT 2
- Priority of sent emails HOT 1
- Helpers do not have all properties HOT 1
- The link to be notified of releases and breaking changes is returning a 500 from Heroku HOT 1
- Multiple Emails HOT 3
- uninitialized constant SendgridService::Personalization HOT 1
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-ruby.