Example of setting headers with CDOSYS


 


//============================ Optional Settings ========================


if (this.Priority.Length != 0)
{
    // Well… it seems that priority is not what needs to be set to get priority set…
    // Looks like setting importance will set priority… at least for cdosys… hmmm
    if (this.Priority == “Non Urgent”)
    {
        oMsg.Fields[“urn:schemas:mailheader:importance”].Value = “Low”;
        //oMsg.Fields[“urn:schemas:mailheader:priority”].Value = “Nonurgent”; // -1
    };  // -1
    if (this.Priority == “Normal”)
    {
        oMsg.Fields[“urn:schemas:mailheader:importance”].Value = “Normal”;
        //oMsg.Fields[“urn:schemas:mailheader:priority”].Value = “Normal”;  // 0
    }; // 0
    if (this.Priority == “Urgent”)
    {
        oMsg.Fields[“urn:schemas:mailheader:importance”].Value = “High”;
        //oMsg.Fields[“urn:schemas:mailheader:priority”].Value = “Urgent”;  // 1
    }; // 1
}


if (this.RequestReadReceipt == true)
{
    oMsg.Fields[“urn:schemas:mailheader:disposition-notification-to”].Value = this.From;
}


if (this.RequestDeliveryReceipt == true)
{
    oMsg.Fields[“urn:schemas:mailheader:return-receipt-to”].Value = this.From;
}


if (this.Sensitivity.Length != 0)
{
    oMsg.Fields[“urn:schemas:mailheader:sensitivity”].Value = this.Sensitivity;
}


// Other headers —————————————-


if (this.MailHeaderName1.Length != 0)
{
    oMsg.Fields[“urn:schemas:mailheader:” + this.MailHeaderName1].Value = this.MailHeaderVal1;
}
if (this.MailHeaderName2.Length != 0)
{
    oMsg.Fields[“urn:schemas:mailheader:” + this.MailHeaderName2].Value = this.MailHeaderVal2;
}
if (this.MailHeaderName3.Length != 0)
{
    oMsg.Fields[“urn:schemas:mailheader:” + this.MailHeaderName3].Value = this.MailHeaderVal3;
}


oMsg.Fields.Update();

Skip to main content