Comments (15)
@thinkingserious I think this issue is not client side bug.
It can reproduce by cURL.
$ curl --request POST --url https://api.sendgrid.com/v3/mail/send --header 'Authorization: Bearer <my api key>' --header 'Content-Type: application/json' --data '{"from":{"name":"unit test","email":"[email protected]"},"subject":"unit test","personalizations":[{"to":[{"email":"[email protected]"}]}],"content":[{"type":"text/plain","value":"テキストだよ"},{"type":"text/html","value":"0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234 567890123456789012345678901234567890123456789012345678901234567890123456789 012345678901234567890123456789012345678901234567890123456789012345678901234 567890123456789012345678901234567890123456789012345678901234567890123456789 012345678901234567890123456789012345678901234567890123456789012345678901234 5678901234567890123456789012345678901234567890123456789"}]}'
{"errors":[{"message":"Unrecognized UTF8 Byte at position 1023","field":null,"help":"http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#-Encoding-Errors"}]}
from sendgrid-go.
@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
415
{"errors":[{"message":"Unrecognized UTF8 Byte at position 1023","field":null,"help":"http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#-Encoding-Errors"}]}
map[Server:[nginx] Date:[Thu, 14 Jul 2016 11:06:56 GMT] Content-Type:[application/json] Content-Length:[172] Connection:[keep-alive]]
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.
from sendgrid-go.
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.
from sendgrid-go.
any update?
from sendgrid-go.
This is in our queue to be fixed ASAP. I'll post any updates here.
Thanks!
from sendgrid-go.
any update?
I need a solution for my project. likes #65
Our project uses gb. but our sub projects can't use it.
CI system update github.com/sendgrid/sendgrid-go
automatically.
Please consider using a gopkg.in
.
from sendgrid-go.
@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.
from sendgrid-go.
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 :)
from sendgrid-go.
Thanks for the additional information @vvakame!
from sendgrid-go.
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?
from sendgrid-go.
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.
from sendgrid-go.
Do you have an ETA when this will be fixed?
I am currently evaluating if I can wait for the fix or if I should use v2 as described in #65
from sendgrid-go.
@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.
from sendgrid-go.
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.
from sendgrid-go.
The fix for this has been deployed :)
Thank you for your patience!
from sendgrid-go.
Related Issues (20)
- Inbound Parse: All attachments have Content-Type: text/plain HOT 5
- uploading contact info returns failed and "you have hit your contact limit"
- GoDoc: “Doc” not displayed due to license restrictions.
- Go Modules Support HOT 4
- Mocks helper
- Create interface for testability HOT 2
- Why I got cors error? HOT 1
- Rate Limiting does not return an error HOT 2
- The template id must be a valid template id for your account issue. HOT 1
- Personalization Subject Override results in (no subject) HOT 5
- Add Email length validation
- Error "The provided authorization grant is invalid, expired, or revoked" when send an email HOT 2
- List-Unsubscribe Header Not Working as Expected HOT 1
- Inbound library does not match sengrid docs or sengrids parsing capability. Serves as a great starter library HOT 5
- Inbound code panics when receiving email from Outlook.com HOT 3
- Bug: inbound.Parse() method panics with text/plain message body HOT 1
- Sending an attachment with a Content-Type including ; (e.g. with character coding specified) causes no "err" and no email... HOT 1
- Getting 500s using Example Code and Status Page Says API is Operational HOT 2
- Support send_each_at mail header HOT 3
- Support Golang 1.18
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-go.