gmailService.Users.Messages.Send Error while copying content to a stream.
See original GitHub issueError when trying to send a message with an attachment in it. note: total attachment file size is around 15mb
System.Net.Http.HttpRequestException: Error while copying content to a stream. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
--- End of inner exception stack trace ---
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Security.SslStreamInternal.<WriteSingleChunk>g__CompleteAsync|36_1[TWriteAdapter](ValueTask writeTask, Byte[] bufferToReturn)
at System.Net.Security.SslStreamInternal.WriteAsyncChunked[TWriteAdapter](TWriteAdapter writeAdapter, ReadOnlyMemory`1 buffer)
at System.Net.Security.SslStreamInternal.<WriteAsyncInternal>g__ExitWriteAsync|35_0[TWriteAdapter](ValueTask task)
at System.
Net.Http.HttpConnection.WriteAsync(ReadOnlyMemory`1 source)
at System.Net.Http.HttpContent.CopyToAsyncCore(ValueTask copyTask)
--- End of inner exception stack trace ---
at Google.Apis.Http.ConfigurableMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) in C:\\Apiary\\2019-08-05.16-52-01\\Src\\Support\\Google.Apis.Core\\Http\\ConfigurableMessageHandler.cs:line 486
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Google.Apis.Requests.ClientServiceRequest`1.ExecuteUnparsedAsync(CancellationToken cancellationToken) in C:\\Apiary\\2019-08-05.16-52-01\\Src\\Support\\Google.Apis\\Requests\\ClientServiceRequest.cs:line 231
at Google.Apis.Requests.ClientServiceRequest`1.Execute() in C:\\Apiary\\2019-08-05.16-52-01\\Src\\Support\\Google.Apis\\Requests\\ClientServiceRequest.cs:line 167
Issue Analytics
- State:
- Created 4 years ago
- Comments:13
Top Results From Across the Web
Receiving 403 error with Users.Messages.Send in Gmail API
I'm trying to call Send on the GmailService from a C# .NET MVC app. and I keep getting a 403 error when I...
Read more >Error while copying content to a stream.
I am trying to do a simple post with SendAsync off of the HttpClient and it fails with the following execptions: Message=One or...
Read more >Sending Email | Gmail
The high-level workflow to send an email is to: Create the email content in some convenient way and encode it as a base64url...
Read more >Re: Seeing 400 error while trying to send a mail
I'm trying to send a mail from my App engine application. I've authenticatied to Gmail API using my service account's key file.
Read more >How to Send and Read Emails with Gmail API
Gmail API is a safe and flexible way to send emails from your app. Here is a full guide on how to access...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m afraid I don’t know on that front. I suspect it’s just not designed to work like that.
Most of this is really about “the GMail API in general” rather than the .NET client libraries… while I know a bit about some of the APIs, there are far too many for me to be an expert in all of them. I suggest using one of the options listed in the support page for more API-specific information. I’m going to close this issue now as I don’t believe there’s an issue with the .NET client library itself, which is what this specific repository is for. Good luck with your application.
Right, I suspect that’s the problem - I believe there’s a 25MB limit for that upload field. I suggest: