locked
send email through outlook RRS feed

  • Question

  • I am writing a email function about send email by logging on user as a sender to send email throught outlook 2003

    how can i avoid security warning dialog to prompt while sending email

    it always prompt this message,please click: http://www.outlookcode.com/article.aspx?id=52 but the case is using VBA to fix, how to fix this problem from my code belows

     public static void addToOutBox(string toValue, string subjectValue, string bodyValue)

     {

     oApp = new Microsoft.Office.Interop.Outlook.Application();

     oNameSpace = oApp.GetNamespace("MAPI");

     //<mapinamespace>.Logon(object Profile, object Password, object ShowDialog, object NewSession)

     oNameSpace.Logon(null, null, true, true);

     

     oOutboxFolder = oNameSpace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderOutbox);

     Microsoft.Office.Interop.Outlook._MailItem oMailItem = (Microsoft.Office.Interop.Outlook._MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);

     oMailItem.To = toValue;

     oMailItem.Subject = subjectValue;

     oMailItem.HTMLBody = bodyValue;

     oMailItem.SaveSentMessageFolder = oOutboxFolder;

     //uncomment this to also save this in your draft

    oMailItem.Save();

    //adds it to the outbox

    oMailItem.Send();

    oNameSpace.Logoff();

     

    I am using VS 2008

    • Edited by --_-- Tuesday, August 31, 2010 7:37 AM
    • Edited by Martin_XieModerator Thursday, September 16, 2010 3:14 PM Refine post layout to make it more readable.
    Tuesday, August 31, 2010 3:00 AM

Answers

  • This is  a third party resolution:

    What is Outlook Redemption?

    <input id="WLSearchBoxInput" style="background-image: url(http://search.live.com//siteowner/s/siteowner/searchbox_background.png); width: 100%; background-repeat: no-repeat; background-position: right 50%; height: 16px; border: transparent 0px; padding: 0px;" maxlength="200" type="text" /> <input id="WLSearchBoxButton" style="border-style: none; padding: 0px;" src="http://search.live.com//siteowner/s/siteowner/searchbutton_normal.png" type="image" />

    Outlook Redemption works around limitations imposed by the Outlook Security Patch and Service Pack 2 of MS Office 98/2000 and Office 2002/2003/2007/2010 (which include Security Patch) plus provides a number of objects and functions to work with properties and functionality not exposed through the Outlook object model.

    As of version 4.0, Redemption library also includes the RDO (Redemption Data Objects) family of objects that can function as a CDO 1.21 replacement.

    With Outlook Redemption you can

    • Make your code run unaffected by the Security Patch.
    • Access properties not exposed by the Outlook Object Model (internet message headers, sender e-mail address and hundreds more properties)
    • Display Address Book.
    • Directly access RTF body of any Outlook item
    • Import MSG, EML (RFC822) and TNEF files
    • Export messages to the MSG, EML, TXT, HTML, TNEF, iCal and vCard formats.
    • Access and manipulate Outlook accounts (Outlook 2002 and above, RDO library)
    • Create, access and manipulate MAPI profiles and accounts (Profman library, see also RDOSession.Profiles)
    • Access MAPI stores.
    • Access Outlook nicknames.
    • Manage Junk Mail settings
    • Manage categories
    • Directly access message attachments as strings or as arrays without saving them as files first
    • And much, much more!

    Link:

    http://www.dimastr.com/redemption/

    Others:

    http://social.msdn.microsoft.com/Forums/en/vsto/thread/5302fb66-145e-4313-a497-f7bfacbb299f

    Regards,

    Jai

    Tuesday, August 31, 2010 6:22 AM
  • I had to solve this problem six years ago on a contract. I did solve it but it wasn't easy. The only solutions at that time and which probably still holds today is to use Extended MAPI. This is directly accessible from either C++ or Delphi and nothing else. So my solution was in C++ (as was the rest of the corporate code that was initially doing the sending of the emails).

    In your original link there is another link to a ".NET linked to C++" example. I would study that but I'm afraid it ain't easy.


    Kevin
    Monday, September 6, 2010 3:57 PM

All replies

  • This is  a third party resolution:

    What is Outlook Redemption?

    <input id="WLSearchBoxInput" style="background-image: url(http://search.live.com//siteowner/s/siteowner/searchbox_background.png); width: 100%; background-repeat: no-repeat; background-position: right 50%; height: 16px; border: transparent 0px; padding: 0px;" maxlength="200" type="text" /> <input id="WLSearchBoxButton" style="border-style: none; padding: 0px;" src="http://search.live.com//siteowner/s/siteowner/searchbutton_normal.png" type="image" />

    Outlook Redemption works around limitations imposed by the Outlook Security Patch and Service Pack 2 of MS Office 98/2000 and Office 2002/2003/2007/2010 (which include Security Patch) plus provides a number of objects and functions to work with properties and functionality not exposed through the Outlook object model.

    As of version 4.0, Redemption library also includes the RDO (Redemption Data Objects) family of objects that can function as a CDO 1.21 replacement.

    With Outlook Redemption you can

    • Make your code run unaffected by the Security Patch.
    • Access properties not exposed by the Outlook Object Model (internet message headers, sender e-mail address and hundreds more properties)
    • Display Address Book.
    • Directly access RTF body of any Outlook item
    • Import MSG, EML (RFC822) and TNEF files
    • Export messages to the MSG, EML, TXT, HTML, TNEF, iCal and vCard formats.
    • Access and manipulate Outlook accounts (Outlook 2002 and above, RDO library)
    • Create, access and manipulate MAPI profiles and accounts (Profman library, see also RDOSession.Profiles)
    • Access MAPI stores.
    • Access Outlook nicknames.
    • Manage Junk Mail settings
    • Manage categories
    • Directly access message attachments as strings or as arrays without saving them as files first
    • And much, much more!

    Link:

    http://www.dimastr.com/redemption/

    Others:

    http://social.msdn.microsoft.com/Forums/en/vsto/thread/5302fb66-145e-4313-a497-f7bfacbb299f

    Regards,

    Jai

    Tuesday, August 31, 2010 6:22 AM
  • This is  a third party resolution:

    What is Outlook Redemption?

    <input id="WLSearchBoxInput" style="background-image: url(http://search.live.com//siteowner/s/siteowner/searchbox_background.png); width: 100%; background-repeat: no-repeat; background-position: right 50%; height: 16px; border: transparent 0px; padding: 0px;" maxlength="200" type="text" /> <input id="WLSearchBoxButton" style="border-style: none; padding: 0px;" src="http://search.live.com//siteowner/s/siteowner/searchbutton_normal.png" type="image" />

    Outlook Redemption works around limitations imposed by the Outlook Security Patch and Service Pack 2 of MS Office 98/2000 and Office 2002/2003/2007/2010 (which include Security Patch) plus provides a number of objects and functions to work with properties and functionality not exposed through the Outlook object model.

    As of version 4.0, Redemption library also includes the RDO (Redemption Data Objects) family of objects that can function as a CDO 1.21 replacement.

    With Outlook Redemption you can

    • Make your code run unaffected by the Security Patch.
    • Access properties not exposed by the Outlook Object Model (internet message headers, sender e-mail address and hundreds more properties)
    • Display Address Book.
    • Directly access RTF body of any Outlook item
    • Import MSG, EML (RFC822) and TNEF files
    • Export messages to the MSG, EML, TXT, HTML, TNEF, iCal and vCard formats.
    • Access and manipulate Outlook accounts (Outlook 2002 and above, RDO library)
    • Create, access and manipulate MAPI profiles and accounts (Profman library, see also RDOSession.Profiles)
    • Access MAPI stores.
    • Access Outlook nicknames.
    • Manage Junk Mail settings
    • Manage categories
    • Directly access message attachments as strings or as arrays without saving them as files first
    • And much, much more!

    Link:

    http://www.dimastr.com/redemption/

    Others:

    http://social.msdn.microsoft.com/Forums/en/vsto/thread/5302fb66-145e-4313-a497-f7bfacbb299f

    Regards,

    Jai


    i have read these websie about security object model,but i don't know how to add the code to my coding to avoid this problem
    Tuesday, August 31, 2010 6:52 AM
  • how can i send email through outlook 2003 and visual studio 2008 and also avoid prompt security dialog.

    anyone help~

    • Merged by Martin_XieModerator Thursday, September 16, 2010 3:15 PM Merge them to keep in the same topic.
    Tuesday, August 31, 2010 3:00 PM
  • Try this link http://www.outlookcode.com/codedetail.aspx?id=776   or  http://support.microsoft.com/kb/313803

    The second link was VB.NET and it easy to translate to C# but if you find it difficult to translate, you can use any of the link below for code conversion

    By the way, can you just make up name if you dont want to reveal your identity which is better than dashes and underscore

    kaymaf


    CODE CONVERTER SITE

    http://www.carlosag.net/Tools/CodeTranslator/.

    http://www.developerfusion.com/tools/convert/csharp-to-vb/.

    Tuesday, August 31, 2010 4:22 PM
  • Dont you have a name and if not just make one up which is better than dashes and underscore

    kaymaf


    CODE CONVERTER SITE

    http://www.carlosag.net/Tools/CodeTranslator/.

    http://www.developerfusion.com/tools/convert/csharp-to-vb/.

    Tuesday, August 31, 2010 4:40 PM
  • Hi, Please when you post code snippets use the </> symbol, and it is working properly
    Regards Thurupathan My blog : http://thurupathan.spaces.live.com
    Tuesday, August 31, 2010 7:37 PM
  • Try this link http://www.outlookcode.com/codedetail.aspx?id=776   or  http://support.microsoft.com/kb/313803

    The second link was VB.NET and it easy to translate to C# but if you find it difficult to translate, you can use any of the link below for code conversion

    By the way, can you just make up name if you dont want to reveal your identity which is better than dashes and underscore

    kaymaf


    CODE CONVERTER SITE

    http://www.carlosag.net/Tools/CodeTranslator/.

    http://www.developerfusion.com/tools/convert/csharp-to-vb/.


    i have send email through outlook 2003, and it always prompt security dialog asking me if i allow to send

    how can i trust the email to avoid prompt this dialog

    Wednesday, September 1, 2010 1:53 AM
  • Try this link http://www.outlookcode.com/codedetail.aspx?id=776   or  http://support.microsoft.com/kb/313803

    The second link was VB.NET and it easy to translate to C# but if you find it difficult to translate, you can use any of the link below for code conversion

    By the way, can you just make up name if you dont want to reveal your identity which is better than dashes and underscore

    kaymaf


    CODE CONVERTER SITE

    http://www.carlosag.net/Tools/CodeTranslator/.

    http://www.developerfusion.com/tools/convert/csharp-to-vb/.


    i have send email through outlook 2003, and it always prompt security dialog asking me if i allow to send

    how can i trust the email to avoid prompt this dialog

    i use MAPI to send email, but always has a prompt dialog (i think through outlook 2003 probelm) when sending email
    Wednesday, September 1, 2010 3:11 AM
  • Hi,

    Welcome to MSDN forums.

     

    Based on your description, I found the following link.

    It is an example for how to add an E-mail to your Microsoft Outlook outbox folder via C#.

    The first thing is you should add a reference ‘Microsoft Outlook 9.0 Object Library’ in your references.

    If your visual studio is 2010, you should add Microsoft Outlook 14.0 Object Library in your references.

    See: http://www.c-sharpcorner.com/uploadfile/casperboekhoudt/sendingemailsthroughoutlook12052005000124am/sendingemailsthroughoutlook.aspx for more information.

    Disable alert prompt via DisplayAlerts property like this:

    Dim outlookApp As Outlook._Application = New Outlook.Application()

    outlookApp.DisplayAlerts = False

    If that does not help, suggest customer to post it at “Outlook for Developers Forum” for better support.

    http://social.msdn.microsoft.com/Forums/en-US/outlookdev/threads

    If you have any issues, please feel free to let me know and capture some screenshots or collect some clarifier information in your reply.

     

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

     

    Best Regards

    Larcolais Gong


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.

    Thursday, September 2, 2010 7:14 AM
  • Hi,

    Welcome to MSDN forums.

     

    Based on your description, I found the following link.

    It is an example for how to add an E-mail to your Microsoft Outlook outbox folder via C#.

    The first thing is you should add a reference ‘Microsoft Outlook 9.0 Object Library’ in your references.

    If your visual studio is 2010, you should add Microsoft Outlook 14.0 Object Library in your references.

    See: http://www.c-sharpcorner.com/uploadfile/casperboekhoudt/sendingemailsthroughoutlook12052005000124am/sendingemailsthroughoutlook.aspx for more information.

     

    If you have any issues, please feel free to let me know and capture some screenshots or collect some clarifier information in your reply.

     

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

     

    Best Regards

    Larcolais Gong


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.

    i can send email, but i don't know how to fix the problem about outlook 2003 when i send the email, always prompt a security dialog ask me send or not.
    Thursday, September 2, 2010 9:02 AM
  • Hi,

     

    I have seen your question here: http://social.msdn.microsoft.com/Forums/en/winforms/thread/d5dc8c20-20f0-4a9e-b899-fff2dbca8215

    Now you can send mail through outlook, you question is how to avoid security warning dialog.

    Would you please print your screen and show the pic here?

    By the way, dose your application run on the web?

    Here is a link about open file-security warning: http://windowsxp.mvps.org/networkfile.htm

     

    Hope these helps, if you have any problems, please feel free to let me know.

     

    Best Regards,

    Alan Chen

    ________________________________________

    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    Monday, September 6, 2010 9:57 AM
    Moderator
  • I had to solve this problem six years ago on a contract. I did solve it but it wasn't easy. The only solutions at that time and which probably still holds today is to use Extended MAPI. This is directly accessible from either C++ or Delphi and nothing else. So my solution was in C++ (as was the rest of the corporate code that was initially doing the sending of the emails).

    In your original link there is another link to a ".NET linked to C++" example. I would study that but I'm afraid it ain't easy.


    Kevin
    Monday, September 6, 2010 3:57 PM
  • Hi --_--

    Welcome to MSDN forums!

     

    Larcolais Gong updated his post with one suggestion, please give it a try.

         Disable alert prompt via DisplayAlerts property like this:

             Dim outlookApp As Outlook._Application = New Outlook.Application()

             outlookApp.DisplayAlerts = False

     

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, September 8, 2010 7:20 AM
    Moderator