Cant able to send mail using SMTP Class

rameshhv

New member
Joined
Dec 1, 2003
Messages
2
Hai...

I am using the code below to send mail using the SMTP Class...

Dim SmtpMail As System.Web.Mail.SmtpMail

Dim from As String = "rameshhv@hotmail.com"
Dim mailto As String = "rameshhv@hotmail.com"
Dim subject As String = "Test Message"
Dim body As String = "<html><body>Testing message from Ramesh</body></html>"

Try
SmtpMail.Send(from, mailto, subject, body)

Catch err As Exception
Response.Write(err.Message)
End Try

It is not saying any errors.. But instead the mail is also not delivered. It is placed in c:\InetPub\Mailroot\Queue.

I dont know how to rectify this problem. Can anybody help me out.
 
Last edited by a moderator:
you need to do something along these lines .....
Code:
        Dim mailmsg As New Web.Mail.MailMessage()
        With mailmsg
            .To = "csharp_@hotmail.com"
            .From = "me@here.net"
            .Subject = "the subject"
            .Body = "<html><body>Testing 12345</body></html>"
            .BodyFormat = Web.Mail.MailFormat.Html
        End With
        Dim mailsvr As Web.Mail.SmtpMail
        mailsvr.SmtpServer = "mail.hotmail.com"
        mailsvr.Send(mailmsg)
 
Back
Top