I’m using SMTPClient to send emails with csv attachments via office 365 and it’s largely working. However, when the attachment size is greater than about 10KB I get an error that crashes my code.
ERROR: LoadError: curl_easy_perform() failed: Failure when receiving data from the peer
I have also tried attaching an XLSX file but same issue. I’m assuming this is a mail server issue but is a change I can make on the client end to overcome this issue?
CSV.write(fn, df)
opt = SendOptions(
isSSL = true,
username = "me@mydomain.com",
passwd = "mypwd"
,verbose=true )
url = "smtp.office365.com:587"
message = string("the message string")
subject = "the subject string"
to = ["<auser@adomain.org."]
cc = ["<auser@live.com.au>"]
bcc = ["<auser@adomain.com>"]
from = "me@mydomain.com"
replyto = "me@mydomain.com"
attachments = [fn]
mime_msg = get_mime_msg(message)
body = get_body(to, from, subject, mime_msg; attachments)
rcpt = vcat(to, cc, bcc)
resp = send(url, rcpt, from, body, opt)
my code code errors on the last line.
Thanks
Steve
Windows 10, VSCode 1.62.1, Julia plugin 1.4.3 Julia 1.6.2
Here is the logging
- Trying 52.98.140.114:587…
- Connected to smtp.office365.com (52.98.140.114) port 587 (#0)
< 220 SY0PR01CA0012.outlook.office365.com Microsoft ESMTP MAIL Service ready at Fri, 12 Nov 2021 01:18:37 +0000
EHLO DESKTOP-QPUMVIR
< 250-SY0PR01CA0012.outlook.office365.com Hello [xxx.xxx.xxx.xxx]
< 250-SIZE 157286400
< 250-PIPELINING
< 250-DSN
< 250-ENHANCEDSTATUSCODES
< 250-STARTTLS
< 250-8BITMIME
< 250-BINARYMIME
< 250-CHUNKING
< 250 SMTPUTF8
STARTTLS
< 220 2.0.0 SMTP server ready
- schannel: added 138 certificate(s) from CA file ‘C:\Users\steve\AppData\Local\Programs\Julia-1.6.2\share\julia\cert.pem’
- schannel: connection hostname (smtp.office365.com) did not match against certificate name (*.clo.footprintdns.com)
- schannel: connection hostname (smtp.office365.com) did not match against certificate name (*.hotmail.com)
- schannel: connection hostname (smtp.office365.com) did not match against certificate name (*.internal.outlook.com)
- schannel: connection hostname (smtp.office365.com) did not match against certificate name (*.live.com)
- schannel: connection hostname (smtp.office365.com) did not match against certificate name (*.nrb.footprintdns.com)
- schannel: connection hostname (smtp.office365.com) did not match against certificate name (*.office.com)
- schannel: connection hostname (smtp.office365.com) validated against certificate name (*.office365.com)
EHLO DESKTOP-QPUMVIR
< 250-SY0PR01CA0012.outlook.office365.com Hello [xxx.xxx.xxx.xxx]
< 250-SIZE 157286400
< 250-PIPELINING
< 250-DSN
< 250-ENHANCEDSTATUSCODES
< 250-AUTH LOGIN XOAUTH2
< 250-8BITMIME
< 250-BINARYMIME
< 250-CHUNKING
< 250 SMTPUTF8
AUTH LOGIN
< 334 VXNhbWU6
c3JhbnNAY3JlYXRpdmVzb2Z0d2Fb20uYXU=
< 334 Uc3dvcmQ6
Y3NzSmFjazI1
< 235 2.7.0 Authentication successful
MAIL FROM:me@mydomain.com
< 250 2.1.0 Sender OK
RCPT TO:auser@adomain.org
< 250 2.1.5 Recipient OK
RCPT TO:auser@live.com
< 250 2.1.5 Recipient OK
RCPT TO:auser@adomain.com
< 250 2.1.5 Recipient OK
DATA
< 354 Start mail input; end with .
< 554 5.6.0 Invalid message content when handling MIME exception. IMC53
- Connection #0 to host smtp.office365.com left intact
ERROR: LoadError: curl_easy_perform() failed: Failure when receiving data from the peer