MailKit icon indicating copy to clipboard operation
MailKit copied to clipboard

Attachments blocked

Open atiqi36 opened this issue 10 years ago • 1 comments

Hi,

I am working with attachements. I have two programs, one composes the email and the second one sends it. So the way it works is when somebody wants to send an email with attachment, they compose the message and upload attachments and the message goes into the database and is queued to go out. The other program takes the message and attach all the attachments from DB binary and sends it.

When I try sending from gmail, I am getting this error which is I think because attachements are going as exe file may be

5.7.0 This message was blocked because its content presents a potential 5.7.0 security issue. Please visit 5.7.0 https://support.google.com/mail/?p=BlockedMessage to review our 5.7.0 message content and attachment content guidelines. x133sm3034537wme.8 - gsmtp

The files I am trying to send are PSD and zip so I don't think google would have any problem with that.

Here is my code of attaching the attachements to message.

if (Attachements != null && Attachements.Count > 0)
            {
                foreach (var attach in Attachements)
                {
                    var attachment = new MimePart()
                    {
                        ContentDisposition = new ContentDisposition(ContentDisposition.Attachment),
                        ContentTransferEncoding = ContentEncoding.Base64,
                        FileName = attach.FileName,

                    };
                    Stream attachStream = new MemoryStream(attach.FileBytes);
                    attachment.ContentObject = new ContentObject(attachStream, ContentEncoding.Binary);
                    multipart.Add(attachment);
                }
            }


atiqi36 avatar Sep 30 '16 09:09 atiqi36

MailKit doesn't turn your attachments into exe's so the problem is simply that GMail doesn't accept your PSD and/or zip attachments.

According to the link in the SMTP error message, it says that Google rejects zip files if they contain any of a number of file types.

jstedfast avatar Sep 30 '16 13:09 jstedfast