-----------------------------------------------------------

New Message on cochindotnet

-----------------------------------------------------------
From: Abu Ismail [KolkataNet]
Message 1 in Discussion

Hi,
In a website if I mentioned the SmtpMail.SmtpServer = “ServerIP” it’s showing 
the same error:
“EXCEPTION Could not access 'CDO.Message' object.”
If I remove, then this is working fine.
The code is as follows. Please help me resolve the problem.

Public Function SendMail(ByVal sFrom As String, ByVal sTo As String, ByVal 
sSubject As String, ByVal sBody As String, Optional ByVal sCc As String = "", 
Optional ByVal sFiles As String = "", Optional ByVal sSmtpServer As String = "")
        Try
            Dim insMail As New MailMessage
            With insMail
                .From = Trim(sFrom)
                .To = Trim(sTo)
                .Subject = 
Trim(sSubject)
                .Body = Trim(sBody)
                .BodyFormat = MailFormat.Html
            End With
            '-- This code is to set the SMTP Server
            If Trim(sSmtpServer) <> "" Then
                SmtpMail.SmtpServer = Trim(sSmtpServer)
            ElseIf ConfigurationSettings.AppSettings("SMTP_Server") <> "" Then
                SmtpMail.SmtpServer = 
ConfigurationSettings.AppSettings("SMTP_Server")
            End If
            SmtpMail.Send(insMail)
        Catch err As 
Exception
            HttpContext.Current.Response.Write("EXCEPTION " + err.Message + 
"<br>")
        End Try
    End Function
Thanks,
Abu

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/CochinDotNet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to