Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: editable or read-only email Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
WLF2022916
Newbie
Newbie
Avatar

Joined: 05 November 2023
Location: United Kingdom
Online Status: Offline
Posts: 10
Posted: 05 November 2023 at 11:56am | IP Logged Quote WLF2022916

Hello
In most email clients, if we make a new email and save it as eml file without sending, once opened again is available for editing.

But received or sent emails once opened are read-only and can't be edited.

When making a new email message with your mail .net and saving as eml file on disk, which property will control this or how can I set it as editable or read-only?
Back to Top View WLF2022916's Profile Search for other posts by WLF2022916
 
WLF2022916
Newbie
Newbie
Avatar

Joined: 05 November 2023
Location: United Kingdom
Online Status: Offline
Posts: 10
Posted: 05 November 2023 at 12:59pm | IP Logged Quote WLF2022916

Hello
This works, am I using it correctly?
MailMessage.Headers.Add("X-Unsent", "1", True)




To remove it (whether it exists or not) is this correct?
MailMessage.Headers.Remove("X-Unsent")

If X-Unsent is not present, is MailMessage.Headers.Remove("X-Unsent") ignored safely or it may throw exception?




Last concern if you don't mind please?
Before saving MailMessage, how to add a line to the very beginning of email (the first line)
I want to add this line to the begin of source MailMessage:
User-Agent: Microsoft-MacOutlook/16.68

Because it is not started with X- , the below code seems to work but it will not be added to the beginning of MailMessage:
MailMessage.Headers.Add("User-Agent", "Microsoft-MacOutlook/16.68", True)
Back to Top View WLF2022916's Profile Search for other posts by WLF2022916
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 06 November 2023 at 1:56am | IP Logged Quote Alex

Hi,

EML format does not have read-only status. Mail clients implement this with their own proprietary means.

> MailMessage.Headers.Add("X-Unsent", "1", True)
It's correct in terms of adding a header. But again, there is no standard mechanism for that. SO it may work with your particular mail client and not with others.

> If X-Unsent is not present, is MailMessage.Headers.Remove("X-Unsent") ignored safely or it may throw exception?
It's correct and safe. Remove will return False if the header was not found. No exception will be thrown.

> Before saving MailMessage, how to add a line to the very beginning of email (the first line)
MailMessage.Headers.Add("User-Agent", "Microsoft-MacOutlook/16.68", True, 0)

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide