How to know E-Mail size?

Hello all,

I have a problem with E-Mail.

I need a way to find size of the e-mail after add attachments to know if it’s possible to send or not.

Can someone help me-

Best regards.

Without testing, would Len(emailmessage.source) give you the answer you need?

I will try.

Simple solutions are the best solutions.

be careful with this: <https://xojo.com/issue/11318> Reading EmailMessage.Source of a message with an attachment before sending will mess up the e-mail

There is obviously something very wrong with the getting & setting of this property. I’ve just finished a project where I had to reference the source in order to include Content In Data graphics. Setting the data here just screwed the message totally.

Jordi to be absolutely safe build the message, get the size then destroy the message & recreate.

What about len(EmailAttachment.data) this will give you the size of the attachement when it’s converted to Base64

There is a bug in example: http://documentation.xojo.com/index.php/EmailAttachment they forgot to instantiate EmailMessage.
Should be:

[code]
Dim file as EmailAttachment
Dim mail as New EmailMessage
If fileFld.text <> “” then
file = New EmailAttachment
file.loadFromFile GetFolderItem(fileFld.text)
mail.Attachments.Append file

msgbox str(file.data.len) // size of the attachement
end if[/code]

Thanks for confirming, Wayne.
Everybody seriously interested in doing eMail with Xojo should try to verify and vote for:

There is also a Class by Daniel Taylor you might want to have a look to: http://webcustomcontrols.com/?p=545
To me the most important bug is 11318. I appreciate any help to get this verified by Xojo and would be happy to see ideas for workarounds till we get a fix.

Oops

one line should be: msgbox str(file.data.lenb) // size of the attachement lenb instead of len

one more on MIME-Encoded headers found by TT: