简体   繁体   中英

How to set mail as 'Important' of gmail using google apis in c#?

I am trying to add mail in gmail account using google apis in c#.

Message f_msg = new Message();
f_ReqforMail = m_MailService.Users.Messages.Insert(f_msg, "me");

How to set that f_msg mail object as 'Important'?

Thanks.

You can try to set the MailPriority Enumeration as:

f_msg.Priority = MailPriority.High

Specifies the priority of a MailMessage.

Remarks

You can use this enumeration to set the priority header of an email message.

If you are using AE.Net.Mail to Build your MailMessage Then You can Use AE.Net.Mail.MailPriority.High to set the Priority. Here is an example:

MailMessage msg = new AE.Net.Mail.MailMessage
{
    Subject = "Your Subject",
    Body = "Hello, World, from Gmail API!",
    From = new MailAddress("[you]@gmail.com"),
    Importance=AE.Net.Mail.MailPriority.High
};

I use:

AE.Net.Mail.MailMessage message = client.GetMessage(uid);
bool isHighLight = message.RawFlags.ToList().Contains("Flagged") ? true : false;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM