Hello,
When Aspose saves VCF files as EML, we’ll have this inside:
Content-Type: text/vcard; charset=“utf-8”
Content-Transfer-Encoding: quoted-printable
But when saving ICS files as EML, we’ll have this:
Content-Type: text/calendar; method=“REQUEST”; name=“meeting.ics”; charset=“utf-8”
Content-Transfer-Encoding: base64
What I’m surprised of is:
When saving ICS as text/calendar its MIME part has file name, not sure but thought if MIME part has file name it’s considered as attachment, if this is expected, why when saving VCF as text/vcard, the MIME part does not have file name like this?
Content-Type: text/vcard; name=contact.vcf; charset=“utf-8”
The filename parameter in content-type is used to suggest a name for storing the file in the filesystem when the file is detached from the message. Why filename parameter was not included when saving VCF as text/vcard, it can depend on the method that was used for saving the file. Can please provide the code sample?
FYI, the absence of a filename parameter in the Content-Type field does not invalidate the MIME part, it just does not suggest a name to be used when the file is separated from the MIME message. If you want to include a filename, you can manually add it yourself.
1 Like
Thanks, 1st of all, I don’t know the current RFCs.
But, I think it was specified that including filename in content-type caused it to become an attachment and be shown in the list of attachments (again not sure about current RFCs)
Anyway, either one is not behaving well (contact or calendar) you should always include it or never do so, including it inside text/calendar while excluding from text/vcard makes things complicated!
Sure, I didn’t claim it’s invalid, just asked about the paradox?
The long method:
Dim MyContact As MapiContact = MapiContact.FromVCard(src)
MyContact.Save(MyMemoryStream1, ContactSaveFormat.Msg)
Dim MyMapiMessage As MapiMessage = MapiMessage.Load(MyMemoryStream1, LoadSetMSG)
Dim MyMailMessage As MailMessage = MyMapiMessage.ToMailMessage(Mapi2MailOpt)
MyMailMessage.Save(“out.mht”, MhtSaveOpt)
You may try your own shortest methods already given before, text/vcard mime part won’t have name!
Thank you.
Just in case asking why used long method? Since each class had its own set of bugs, most of my code is using workarounds.
We have opened the new ticket to fix this little thing.
Issue ID(s): EMAILNET-41115
And of course, you can always add the filename in your code without waiting for our fix.
var mapiContact = MapiContact.FromVCard(vcfName).GetUnderlyingMessage();
MailMessage contEml = mapiContact.ToMailMessage(new MailConversionOptions());
foreach (AlternateView view in contEml.AlternateViews)
{
if (view.ContentType.MediaType == "text/vcard")
{
view.ContentType.Name = "contact.vcf";
}
}
contEml.Save("contact.eml");
1 Like
Hello,
There’s a bug in loading Vcf and saving as Eml (and maybe Mht):
VcfProblem.zip (3.9 MB)
1st compare the contents of source Vcf files: OK.vcf vs NO.vcf
Now run the sample project and compare the resulting Eml files:
snapshot.png (186.4 KB)
I don’t see the bug here. No.vcf contains nothing but the address. So the eml contains neither the subject nor the attachment name. The subject and attachment name are taken from the contact name.
Hello
I see this case is closed, so is this fixed? Because I didn’t find it in the release notes