By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,143 Members | 865 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,143 IT Pros & Developers. It's quick & easy.

send mail with remote smtp

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Jos
ratnesh wrote:
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 = so*****@somedomain.com
oMail.From = so*********@somedomain.com
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)

--

Jos
Nov 18 '05 #2

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

"Jos" <jo***************@fastmail.fm> wrote in message
news:#d**************@TK2MSFTNGP12.phx.gbl...
ratnesh wrote:
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 = so*****@somedomain.com
oMail.From = so*********@somedomain.com
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)

--

Jos

Nov 18 '05 #3

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


Fields only works in dotNET version 1.1.
See
http://www.dotnet247.com/247referenc...49/248767.aspx
for a similar problem.

If you get this problem on your development server, you
may install v1.1 (www.asp.net), even if you don't
develop in Visual Studio 2003.

--

Jos
Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.