Email attachment received as Corrupt and no name

Greetings ,

I’m trying to use the sample code from Examples to send an email with attachment , the problem is that even if I set It as PDF and send it properly when I receive the mail from the app instead of the file with the name I get an attachment called Mail attachment.pdf and when I try to open it it says that it cannot be opened and it appears to be corrupt , any idea on this ? and there is a way to actually keep the name and the integrity of it ?

Sample code you find it in Examples folder and what I added extra was the MIME and added the line in the code :

[quote]// add attachments
If fileFld.Text <> “” Then
file = New EmailAttachment
file.LoadFromFile(GetFolderItem(fileFld.Text))
file.MIMEType = FileTypes.Pdf
mail.Attachments.Append(file)
End If
[/quote]

Thanks .

Sending mails with attachments has been broken for a couple of years. Use CURL from the MBS plugin or the Chilkat plugin.

Well I try to avoid plugins so native code only . And no chance to get it fixed soon ? XOJO Team !!!

Well, it’s Black Friday sale, so you can get our plugin for a lower price…

some example codes to look at , and get email attachments coding ideas :

https://github.com/mattmilano/indieIMAP

https://sourceforge.net/p/zymail/code/HEAD/tree/

Thanks a lot Sean, it seems that the trick did the job and it is not broken after all.

So for everybody to use it in case needed.

In the examples in the Send Button you have the following code :

// add attachments If fileFld.Text <> "" Then file = New EmailAttachment file.LoadFromFile(GetFolderItem(fileFld.Text)) mail.Attachments.Append(file) End If
Replace it By

// add attachments If fileFld.Text <> "" Then file = New EmailAttachment file.LoadFromFile(GetFolderItem(fileFld.Text, 3)) mail.Attachments.Append(file) End If

[quote]file.LoadFromFile(GetFolderItem(fileFld.Text, 3))[/quote] which sets the path as native path.