send email with .net code

G

Guest

I need help please!

I write a method to send email and there is a button on a web page, click
the button will call the method. everything seems ok. but the email never be
sent.
--------------------
button click: SendMail("(e-mail address removed)")

Public Function SendMail(ByVal toAddr As String) As Boolean
Dim myMessage As New MailMessage

myMessage.To = toAddr
myMessage.From = "(e-mail address removed)"
myMessage.Subject = "Vaughan GIS System"
myMessage.BodyFormat = MailFormat.Text

myMessage.Body = "www.vaughangis.info"

Mail.SmtpMail.SmtpServer = "10.141.140.69"

Try
SmtpMail.Send(myMessage)
Catch ex As Exception
ErrMsg = ex.Message
Return False
End Try
Return True
End Function
---------------
 
C

Cowboy \(Gregory A. Beamer\)

1. Make sure you have an SMTP server set up (can be Exchange)
2. Make sure you are configured to use this server
3. Make sure you have rights to relay messages if you are using a server

Any of these can bomb things. If you are using the MS SMTP Server that ships
with the OS, check the mail folder and see if you have stuck messages. If
so, you are contacting the SMTP service, but it is not relaying the messages
(does not know how to send things out). If not, you are not properly
configured to use the SMTP service.

If you are using Exchange or another server option, check with your admin
and see if you are even getting into the system.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
 

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

Similar Threads


Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,016
Latest member
TatianaCha

Latest Threads

Top