-
Notifications
You must be signed in to change notification settings - Fork 260
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
Send mail failed with v3 API and multi-byte contents. #66
Comments
any update? |
This is in our queue to be fixed ASAP. I'll post any updates here. Thanks! |
@thinkingserious For clarity, is this a Sendgrid V3 server-side bug? I think I am running into the same issue using the latest sendgrid-java client. Mail that used to go through V2 fails in V3 with the "Unrecognized UTF8 Byte" error message. Update: Maybe it's not server-side. This looks like the relevant pull request, though it was admittedly harder to find since the corresponding sendgrid-java issue had already been closed: sendgrid/java-http-client#5 Sorry for the noise here. |
It is a client side bug. The issue is that when we send the request body JSON, I did not consider the multi-byte characters when calculating the length, which causes it to be truncated. Thanks for speaking up though because every voice helps bump the ticket up our queue to be fixed :) |
@thinkingserious I think this issue is not client side bug.
|
Thanks for the additional information @vvakame! |
If I do: curl -X "POST" "https://api.sendgrid.com/v3/mail/send" \
-H "Authorization: Bearer $SENDGRID_API_KEY" \
-H "Content-Type: application/json" \
-d @post.json where post.json is: {
"from": {
"name": "unit test",
"email": "[email protected]"
},
"subject": "unit test",
"personalizations": [{
"to": [{
"email": "[email protected]"
}]
}],
"content": [{
"type": "text/plain",
"value": "テキストだよ"
}]
} The email is delivered as expected. There appears to be some issue in that string of numbers. Is there some sort of non utf-8 special character in there? |
I've been able to confirm that it is an API client issue and a bug has been filed. When it get's fixed, I'll post here. Thanks for your patience and help with tracking this issue down. |
Do you have an ETA when this will be fixed? |
@thinkingserious I got the same problem when I try to send email written in Japanese then email was not delivered and the error was appeared. I think it is caused by the length of body. Please see the examples below. package main
import (
"fmt"
"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/helpers/mail"
"os"
)
func main() {
from := mail.NewEmail("sender", "[email protected]")
to := mail.NewEmail("receiver", "[email protected]")
content := mail.NewContent("text/plain", "こんにちは")
m := mail.NewV3MailInit(from, "テスト", to, content)
request := sendgrid.GetRequest(os.Getenv("SENDGRID_API_KEY"), "/v3/mail/send", "https://api.sendgrid.com")
request.Method = "POST"
request.Body = mail.GetRequestBody(m)
resp, err := sendgrid.API(request)
if err != nil {
panic(err)
}
fmt.Println(resp.StatusCode)
fmt.Println(resp.Body)
fmt.Println(resp.Headers)
} It's ok. but package main
import (
"fmt"
"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/helpers/mail"
"os"
)
func main() {
from := mail.NewEmail("sender", "[email protected]")
to := mail.NewEmail("receiver", "[email protected]")
content := mail.NewContent("text/plain", "こんにちはああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああ!!!!")
m := mail.NewV3MailInit(from, "テスト", to, content)
request := sendgrid.GetRequest(os.Getenv("SENDGRID_API_KEY"), "/v3/mail/send", "https://api.sendgrid.com")
request.Method = "POST"
request.Body = mail.GetRequestBody(m)
resp, err := sendgrid.API(request)
if err != nil {
panic(err)
}
fmt.Println(resp.StatusCode)
fmt.Println(resp.Body)
fmt.Println(resp.Headers)
} It outputs the error
And, it's appeared in a byte of 2 of the multiplier - 1, for example 511 and 1023. I hope it will be your help, and I use v2.0.0 with glide until it be fixed. |
I don't have an ETA, but the continued comments and votes help move it up the queue. Also, I will be advocating again for a quick fix today at our stand up. @Rompei, Thanks! I'll pass this along to the team. |
@thinkingserious Come on, guys! It's a blocker bug on server side that is known for a month already. I guess a lot of your clients believe their email are delivered when they are not. |
I sincerely wish it was fixed 3 months ago :( The good news is that it's currently in this sprint and is now being actively worked on. I'm looking forward to announcing the fix very soon. |
The fix for this has been deployed :) Thank you for your patience! |
Issue Summary
We can't send a mail via v3 API with multibyte content.
Steps to Reproduce
Technical details:
I'm posted this issue to SendGrid support. Request # 691762
The text was updated successfully, but these errors were encountered: