Skip to content
Loading
  • Varun Setia
    +2
    1. String myOffice = dirEntry.Properties["physicalDeliveryOfficeName"].Value.ToString();    
    2. String srEmail = "";       
    3. if (myOffice == "Leeds")      
    4. {      
    5. srEmail = "[email protected]";      
    6. }      
    7. else if (myOffice=="Sheffield")      
    8. {      
    9. srEmail = "[email protected]";      
    10. }      
    11. else if (myOffice =="York")      
    12. {      
    13. srEmail = "[email protected]";      
    14. }      
    15. String Date = DateTime.Now.ToShortDateString();      
    16. if(srEmail.Length>0){      
    17. Outlook.Application app = new Outlook.Application();      
    18. Outlook.MailItem mailItem = app.CreateItem(Outlook.OlItemType.olMailItem);      
    19. mailItem.Subject = "New Stationary Order - " + myName + ":" + Date;      
    20. mailItem.To = srEmail;      
    21. string htmlString = @"      
    22. //..  
    23. }  
    +2
  • Salman Beg
    +2
    Hey.
    Declare srEmail globally and assign the value in if elseif etc and then finally assign srEmail into mailItem.To.Thanks.
    +2
  • +2
    Thank you for the response. made alot of sense and works a charm
    +2