-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reply_to has no effect #52
Comments
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 |
I'm just setting up a basic hash. I would like to send from info@mycutsapp.com 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 info@mycutsapp.com if it's coming from a yahoo.com account :(
from = self.from.include?("@yahoo.com") ? "info@mycutsapp.com" : 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 |
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 |
sendgrid = SendGrid::Client.new do |c|
c.api_key = ENV["SENDGRID_APIKEY"]
end
email = arg
sendgrid.send email |
|
Ah, ok, I'll try that. Thanks. |
Thanks! Please let us know how it goes. |
I finally got around to upgrading to v3. When I tested using reply_to, it still doesn't work.
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? |
Before you make the call to |
{
"from": {
"email": "info@mycutsapp.com",
"name": "bing bong berry"
},
"subject": "hopefully can reply to",
"personalizations": [
{
"to": [
{
"email": "coderdave@gmail.com"
}
]
}
],
"content": [
{
"type": "text/plain",
"value": "Hello, Email!"
}
],
"reply_to": {
"email": "davidsanderson101@yahoo.com",
"name": "bing bong berry"
}
} |
Please try putting that payload in a file named 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 |
Same effect, email went through but it replies to "info@mycutsapp.com" |
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? |
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 info@mycutsapp.com one. |
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. |
Thanks for following up with your solution! |
Update LICENSE.txt
I'm setting the
reply_to
but when you click to reply to the email, it's replying to theto
email. Am I doing something wrong?The text was updated successfully, but these errors were encountered: