Hi,
I have given a sample code below which would work from the development server. (if your company is using Microsoft exchange server)
Step 1:
Public Sub SendEmail(ByVal Toaddress as string, ByVal body
as string, ByVal subject as string, ByVal ishtml as Boolean)
Dim
Msg As New
MailMessage
Try
Msg.From = New MailAddress(ConfigurationManager.AppSettings("EmailFromAddres").ToString,
ConfigurationManager.AppSettings("EmailFromAddressDisplayName").ToString)
Msg.To.Add(New MailAddress(Toaddress))
Msg.Subject
= subject
Msg.Body
= body
Msg.IsBodyHtml = ishtml
Msg.Priority =
MailPriority.Normal
' to
connect to the exchange server by using info in the web.config
Dim
client As New
SmtpClient(ConfigurationManager.AppSettings("ExchangeServerName").ToString())
client.DeliveryMethod =
SmtpDeliveryMethod.Network
client.UseDefaultCredentials =
True
client.Port =
ConfigurationManager.AppSettings("ExchangeServerPort").ToString()
client.Timeout =
ConfigurationManager.AppSettings("ExchangeServerTimeout").ToString()
'send
the email
Try
client.Send(Msg)
Catch
ex As Exception
Exit
Sub
End
Try
Catch
ex As Exception
Finally
Msg = Nothing
End Try
End Sub
Step 2:
change your web.config to include the following information about your company's exchange server
<configuration>
<appSettings>
<add key="ExchangeServerName" value="CWcwcw"/>
<add key="ExchangeServerPort" value="25"/>
<add key="ExchangeServerTimeout" value="999999"/>
<add key="EmailFromAddres" value="something@somedomain.com"/>
<add key="EmailFromAddressDisplayName" value="Mr Someone"/>
</appSettings>
</configuration>
Hope this helps.
Please let me know if you need any other help.