Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDotNetNuke.Entities.Host.HostSettings is obsoleteDotNetNuke.Entities.Host.HostSettings is obsolete
Previous
 
Next
New Post
6/16/2012 3:02 AM
 

Hi All,

I recently started having SMTP errors from one of the modules I programmed a while back but still use. I guess much has changed, so it is time to do some upgrading. My first start is : Imports DotNetNuke.Entities.Host.HostSettings is obsolete. My code is as follows, I have tried many things but can't get it to work. Please help me convert it to DNN5 standards:

Imports DotNetNuke.Entities.Host.HostSettings

Dim hostSetting As String = CType(hostSettings("SMTPAuthentication"), String)
                Dim mail As New System.Net.Mail.MailMessage
                Dim EmailNotifyTo As String = CType(Settings("EmailNotifyTo"), String)
                Dim EmailNotifyFrom As String = CType(hostSettings("SMTPUsername"), String)
                Dim EmailNotifySubject As String = CType(Settings("EmailNotifySubject"), String)
                Dim EmailNotifyBody As String = CType(Settings("EmailNotifyBody"), String)
                If hostSetting = "0" Then
                    mail.To = EmailNotifyTo
                    mail.From = EmailNotifyFrom
                    mail.Subject = EmailNotifySubject
                    mail.BodyFormat = MailFormat.Html
                    mail.Body = EmailNotifyBody & "<br><br>" & "This message was sent: " & DateTime.UtcNow & "."
                    System.Net.Mail.SmtpClient..SmtpServer = CType(hostSettings("SMTPServer"), String)  'your real server goes here
                    SmtpMail.Send(mail)
                ElseIf hostSetting = "1" Then
                    mail.To = EmailNotifyTo
                    mail.From = EmailNotifyFrom
                    mail.Subject = EmailNotifySubject
                    mail.BodyFormat = MailFormat.Html
                    mail.Body = EmailNotifyBody & "<br><br>" & "This message was sent: " & DateTime.UtcNow & "."
                    'Authentication
                    mail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
                    mail.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
                    mail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
                    mail.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = CType(hostSettings("SMTPUsername"), String)
                    mail.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = CType(hostSettings("SMTPPassword"), String)
                    'Authentication
                    SmtpMail.SmtpServer = CType(hostSettings("SMTPServer"), String) 'your real server goes here
                    SmtpMail.Send(mail)
                Else
                    'Do Nothing
                    '3rd NTLM Option left out because I don't know the real details as to what it does... I should tell it to use "0" or "1" by default.
                End If 


Thuan
 
New Post
7/5/2012 9:45 PM
 
Use DotNetNuke.Entities.Host.Host

This should let you access the properties you need. For a complete reference check out: http://www.dotnetnukeru.com/dnndocs/api/html/T_DotNetNuke_Entities_Host_Host.htm

 
New Post
7/5/2012 9:46 PM
 

Use DotNetNuke.Entities.Host.Host

This should let you access the properties you need. For a complete reference check out:  http://www.dotnetnukeru.com/dnndocs/api/html/T_DotNetNuke_Entities_Host_Host.htm 

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDotNetNuke.Entities.Host.HostSettings is obsoleteDotNetNuke.Entities.Host.HostSettings is obsolete


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out