What I want to do is to create a mail attachment from a string file and give it my own custom extension.
public void CreateAttachment(string encryptedString, string fileName)
{
mail.Attachments.Add(Attachment.CreateAttachmentFromString(encryptedString, fileName));
}
I want to create a ".bzk" file and it's gonna be opened in a mobile Android application later. How do I do this? I know there are different constructors as you can see here!
I do not know what constructors I have to use and even after trying different MIME types and Encodings, it won't work. Can anyone tell me how to do this?
edit:
I've solved my problem. Here is my solution:
public void CreateAttachment(string encryptedString, string fileName)
{
MemoryStream ms = new MemoryStream(
ASCIIEncoding.ASCII.GetBytes(encryptedString)
);
Attachment attachment = new Attachment(ms, new ContentType("text/bzk"));
attachment.Name = fileName + ".bzk";
mail.Attachments.Add(attachment);
}