send mail with remote smtp

R

ratnesh

hi,

how can i send smtp mail from my asp.net webform.
i give the smtp server name,
but the server is remote and it requires authentication (login) to send
mail.
i dont know how to do that

thanks
 
J

Jos

ratnesh said:
hi,

how can i send smtp mail from my asp.net webform.
i give the smtp server name,
but the server is remote and it requires authentication (login) to
send mail.
i dont know how to do that

Try something like this:

Dim oMail As MailMessage = New MailMessage()
oMail.To = (e-mail address removed)
oMail.From = (e-mail address removed)
oMail.Subject = "Important message"
oMail.Body = "Your message here."
oMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverp
ort",25)
oMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing",
2)
oMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthent
icate",2)
oMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusernam
e","yourusername")
oMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpasswor
d","yoursecretpassword")
SmtpMail.SmtpServer = "smtp.yourserver.com"
SmtpMail.Send(oMail)
 
R

ratnesh

please help me
WebForm1.aspx.vb(45): 'Fields' is not a member of
'System.Web.Mail.MailMessage'.
this error is showing up.
thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top