Terranet Technologies  Welcome to TNet   Sign Up  Login 
           
HomeDevelopmentConsultingSolutionsUsersSupport
zip:
Weather in Tulsa, OK (74133)
Current Conditions:
Fair 79°F
Fair
Wind: CALM calm mph
SAT
9/4
Clear

L:55
SUN
9/5
Sunny
H:89
L:64
MON
9/6
Sunny / Wind
H:93
L:69
TUE
9/7
Scattered T-Storms
H:87
L:68

Last Update: 5:05:40 PM
weather.com

Services
ASP.Net
C#
VB
TSQL
   

Welcome to Terranet Technologies forum.  This is a private Web Service so it will require you to create a seperate account other than your Terranet account.   Please use your existing Terranet user name.  It will only require your email and a password to join.

Join | Logon
 All Threads | New ThreadView:  Search:  
 Author  Thread: ASP.Net 2.0 Email
mdboy
Posts: 2
ASP.Net 2.0 Email
Posted: 14 Mar 07 7:11 AM
I am trying to send an email using Visual Studios 2005. Any help would be appreciated.
[Reply][Quote]
kroesch
Posts: 10
Re: ASP.Net 2.0 Email
Posted: 14 Mar 07 8:27 AM
This works for me.

under configuration in the web.config file enter:
(under host be sure to enter you mail server ip address)

<system.net >
<mailSettings>
<smtp from="support@terranettech.net">
<network host="0.0.0.0" password="" userName=""/>
</smtp>
</mailSettings>
</system.net>

Code:

using System.Net.Mail;

public static void SendOutEmail(string to, string from, string sub, string body)
{
SmtpClient smtpClient = new SmtpClient();
MailMessage message = new MailMessage();

try
{
message.From = new MailAddress(from);
message.To.Add(new MailAddress(to));
message.Subject = sub;
message.Body = body;
//message.Attachments.Add(new Attachment(attch));

smtpClient.Send(message);
}
catch (Exception ex)
{
throw new System.Exception(ex.Message);
}
}

[Reply][Quote]
mdboy
Posts: 2
Re: ASP.Net 2.0 Email
Posted: 14 Mar 07 8:41 AM
Thank you I am uncertain about where to place and call my email server address?
[Reply][Quote]
kroesch
Posts: 10
Re: ASP.Net 2.0 Email
Posted: 15 Mar 07 7:01 AM
Under the web.config files in the above instuctions where you see 0.0.0.0 here put your exchanges servers ip address.
[Reply][Quote]
 Page 1 of 1 

Copyright© 1998 - 2010 Terranet Technologies LLC All rights reserved.