Hi the SMTP emailing is working fine in foreign language, including the subject heading.
I’m now trying to add file attachment. I used a pdf that has Japanese characters as filename.
Was able to email out but the receiving end is receiving a scrambled up ASCII lettering as file name.
How to I encode the file name so that it stays in its original language before sending out?
Use CURL from the MBS plugin or the Chilkat plugin. There is no known workaround.
Check out our CURLEmailMBS class.
from this post : https://forum.xojo.com/46501-problem-with-email-attachments-in-xojo-example-files
may be you can try this trick (for the file.name only) :
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)
Hi,
I’ve actually tried something similar…maybe my coding is wrong…?
The result was a file was emailed but the name got changed automatically to realbasic_xojo.pdf and when I tried to read it, it could not be open saying that it was not properly decoded.
mail. …
mail. …
mail.AddRecipient(“info@honjofudousan.com”)
If SelectedFolderItemLabel.Text <> “” Then
Dim file As New EmailAttachment
Dim fileName As String
Dim fileExtension As String
file.LoadFromFile(GetFolderItem(file.Name, FolderItem.PathTypeAbsolute))
fileName = Replace(file.Name, "." + (NthField(file.Name, ".", 2)), "")
fileExtension = NthField(File.Name, ".", 2)
file.MIMEType = "application/pdf"
file.ContentEncoding = "base64"
file.Name = "=?UTF-8?B?" + EncodeBase64(fileName + "." + fileExtension, 0) + "?="
mail.Attachments.Append(file)
end if
Any feedback greatly appreciated.
replace
file.LoadFromFile(GetFolderItem(file.Name , FolderItem.PathTypeAbsolute))
with
file.LoadFromFile(GetFolderItem(SelectedFolderItemLabel.Text , FolderItem.PathTypeAbsolute))
?
Works perfectly! Thank you very much!