How to send Authenticated SMTP mail in 1.14 with Visual J Sharp

Last post 10-09-2007 3:20 AM by XiaoYong Dai – MSFT. 1 replies.

Sort Posts:

  • How to send Authenticated SMTP mail in 1.14 with Visual J Sharp

    10-04-2007, 9:47 AM

    I have an application not of my own design but I need to add authentication to the smtp mailer.

    I found the following code for VB.net

    msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") ;

    msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "user");

    msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password");

     

     I get the following error when trying to use this in VJ#

    Cannot find field 'Fields' in class 'System.Web.Mail.MailMessage'

     Can anyone point me in the right direction. I have a client who cannot recieve emails on there web page anymore and they are desperate.

     

    Thanks

  • Re: How to send Authenticated SMTP mail in 1.14 with Visual J Sharp

    10-09-2007, 3:20 AM
    Answer

    Hi

    You can use the get_Fields() method of "MailMessage" class. It will allow you add authentication to the smtp mailer just like what you have done in VB.NET or C#

    Here is the code example in J#, Hope it helps.

        System.Web.Mail.MailMessage ms1=new System.Web.Mail.MailMessage;
        ms1.get_Fields().Add(Object key, Object value);

    Best Regards
    XiaoYong Dai
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Page 1 of 1 (2 items)