problem with email attachments (in xojo example files)

  1. ‹ Older
  2. 4 months ago

    Alberto D

    Mar 13 Pre-Release Testers, Xojo Pro

    And this is what I get (source) from Gmail:

    Content-Type: application/pdf; name="test.pdf"; name="test.pdf"x-mac-type="00000000" x-mac-creator="00000000"
    Content-transfer-encoding: Base64
    Content-disposition: attachment; filename="test.pdf"; filename="test.pdf"

    No name*=utf-8 or filename*=utf-8, but the values are duplicate.

    The filename shown on Gmail is not duplicate and when I download the file it gets saved as 'test.pdf'

    So the bug still there and I guess different email apps handle that issue in different way.

  3. Jean-Yves P

    Mar 14 Pre-Release Testers, Xojo Pro Europe (France, Besancon)

    I've just been flagged as a spam emailer by my smtp provider ... ;)
    I don't think I've sent more than 30 emails, and only 10's have actually arrived to the recipient.
    do you know the main criterias used by the smtp servers to check for a spam potential ?
    anything simple I could have missed in the content of my automated emails ?
    ( they just send a small text, with a pdf attached, to a customer)
    thanks.

  4. Beatrix W

    Mar 14 Pre-Release Testers Europe (Germany)

    Usually, it's the number of mails you send. That's the main reason you should use something like SendGrid, Mandril or similar. You can send up to 200 mails with SendGrid per day for free.

  5. Jean-Yves P

    Mar 14 Pre-Release Testers, Xojo Pro Europe (France, Besancon)

    it's strange because I can still send emails with apple Mail, but with my xojo program they are all considered as spam.
    so I definitely think it's what's inside the mail that causes problems. may be some missing header ?

  6. Albin K

    Mar 14 Europe (Sweden)

    Could be a header problem. I’ve build a system that’s sending hundreds of emails on a single day. I remember having some issues when developing this, I can take a look at my code tonight(if you haven’t figured it out by then)

  7. Alberto D

    Mar 14 Pre-Release Testers, Xojo Pro

    Are you using this from the demo?:

    mail.Headers.AppendHeader("X-Mailer","Xojo SMTP Demo")

    Somethings to check:

    • header differences between an email from apple Mail and your app
    • if you are connecting to the preferred server port (465 or 587)
    • maybe check how many mails per minute you are sending
    • if you send to a gmail account you can select 'Show Original' and will tell you if your email passed SPF and DKIM tests

    Are you using Gmail smtp server or other server?
    What server is marking your emails as spam, the smtp server or the receiving server? If it is the receiving server is one in particular, like Gmail, Hotmail, company server, or all of them?

  8. Albin K

    Mar 14 Europe (Sweden)
    Edited 4 months ago

    Make sure your emails are multipart.
    That is, they contain an HTML part and a TEXT part.
    I think there was a header too for that.. don’t have my code here right now..

    Some filters do block emails that only contain simple TEXT.

    I recommend MailJet as SMTP.

  9. Jean-Yves P

    Mar 14 Pre-Release Testers, Xojo Pro Europe (France, Besancon)

    @Albin K Make sure your emails are multipart.
    That is, they contain an HTML part and a TEXT part.

    it was working when there was only a simple text and a pdf attachment.
    yesterday I added an RTF text, but no HTML, and I got stopped by the smtp server (my provider)
    I removed the RTF part and it's still blocked.
    there is no HTML part in the mail. should I add one ?

  10. Jean-Yves P

    Mar 14 Pre-Release Testers, Xojo Pro Europe (France, Besancon)

    @Alberto D;Poo maybe check how many mails per minute you are sending

    one to 3 in a minute, then I stop as it is a manual operation now.

  11. Jean-Yves P

    Mar 14 Pre-Release Testers, Xojo Pro Europe (France, Besancon)

    @Alberto D;Poo Are you using Gmail smtp server or other server?
    What server is marking your emails as spam, the smtp server or the receiving server? If it is the receiving server is one in particular, like Gmail, Hotmail, company server, or all of them?

    I use the french provider "free", it is my provider smtp server that's blocking the mails I send.

  12. Alberto D

    Mar 14 Pre-Release Testers, Xojo Pro

    You could try to add HTML part, but if your provider is blocking you maybe they have now a filter for your email (at least if the headers are the same as before, that's why there are no issues with apple Mail).

    Do you have a X-mailer defined? You can try to remove that or change it.

    If I were you I'll look for other smtp provider.

  13. Beatrix W

    Mar 14 Pre-Release Testers Europe (Germany)

    See for instance here: http://support.e-zekiel.com/templates/System/details.asp?id=31606&fetch=26444 . So no, changing the provider will not solve the problem.

  14. Alberto D

    Mar 14 Pre-Release Testers, Xojo Pro
    Edited 4 months ago

    Sorry, for provider I was thinking about SendGrid, Mandril or similar.

    For me is weird that only sending 30 emails his provider will block them. I don't consider sending 30 or 100 emails a day 'bulk mail'. Even the information on that link say 250 recipients at any given time (not defining time).

  15. Jean-Yves P

    Mar 14 Pre-Release Testers, Xojo Pro Europe (France, Besancon)

    @Alberto D;Poo Are you using this from the demo?:

    mail.Headers.AppendHeader("X-Mailer","Xojo SMTP Demo")

    I'm using

    mail.Headers.AppendHeader("X-Mailer","My Xojo Name App")
  16. Beatrix W

    Mar 14 Pre-Release Testers Europe (Germany)

    As far as I understand Jean-Yves is using is own ISP where the link I gave applies. For Mandril, SendGrid etc. this does NOT apply.

  17. Jean-Yves P

    Mar 14 Pre-Release Testers, Xojo Pro Europe (France, Besancon)

    @Albin K Could be a header problem. I’ve build a system that’s sending hundreds of emails on a single day. I remember having some issues when developing this, I can take a look at my code tonight(if you haven’t figured it out by then)

    I would really appreciate ! thanks.

  18. Albin K

    Mar 14 Europe (Sweden)
    Edited 4 months ago

    I ended up with this code, it's been a while so I can't tell why I did this, or that though :)

     
    mail.Headers.AppendHeader("MIME-version", "1.0")
    mail.Headers.AppendHeader("Content-type", "multipart/alternative; charset=UTF-8")
    mail.Subject = "=?UTF-8?B?" + EncodeBase64(DefineEncoding(emailSubject, Encodings.UTF8)) + "?="
    mail.BodyHTML = DefineEncoding(emailContent_HTML, Encodings.UTF8)
    mail.BodyPlainText = DefineEncoding(emailContent_TEXT, Encodings.UTF8)
    mail.fromAddress = "=?UTF-8?B?" + EncodeBase64(DefineEncoding(smtpFrom, Encodings.UTF8)) + "?=" + "<" + smtpSender + ">"

    All the ?UTF-8?B? was to make sure the encoding worked on all readers, it seems it did :)

    I'm also attaching images using this:

    file.LoadFromFile(GetFolderItem(Attachments.Name(x), FolderItem.PathTypeShell))
    fileExtension = NthField(file.Name, ".", 2)
    file.MIMEType = "image/jpeg"
    file.ContentEncoding = "base64"
    file.Name = "=?UTF-8?B?" + EncodeBase64(DefineEncoding(Attachments.Value(Attachments.Name(x)) + "." + fileExtension, Encodings.UTF8)) + "?="
    mail.Attachments.Append(file)
  19. Jean-Yves P

    Mar 14 Pre-Release Testers, Xojo Pro Europe (France, Besancon)

    you did not use a X-Mailer header ?

  20. Albin K

    Mar 14 Europe (Sweden)
    Edited 4 months ago

    @Jean-YvesPochez you did not use a X-Mailer header ?

    Nope, I did not :)

    Unfortunately, many spam senders these days are able to send messages without an X-Mailer header or to simply use popular email programs, which no spam filter is going to flag, such as Microsoft Outlook. As a result, the X-Mailer header is only partially helpful for filtering spam.

    Also, it's using MailJet as SMTP.

  21. Jean-Yves P

    Mar 14 Pre-Release Testers, Xojo Pro Europe (France, Besancon)

    so the problem was that I did not send any HTML in the mail. sending RTF part is useless ans smtp server block it.
    I removed the bodyenriched, added the bodyHTML, and the message was accepted.
    thanks for the helps

    now I have to figure how to transform RTF to HTML the most better looking way possible...

or Sign Up to reply!