473,471 Members | 1,684 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

What is the best way to create an asp.net mailer?

103 New Member
I am building a web form application and have a communication requirement. I will be developing a email function, an mass email function, and a message board. Any suggestions or how to start would be great. The application I am building is for a building application. If I want to email all the tenants, then I would query all occupants and send an email? Thanks for your help in advance from the newbie..ME!
Mar 23 '11 #1

✓ answered by vivek kapile

public static bool SendMail(string to,string subject,string body)
{
bool flag = false;
try
{
MailMessage msg = new MailMessage();
SmtpClient smtp = new SmtpClient(ConfigurationManager.AppSettings[Constants.SMTPSERVERADDRESS].ToString());
msg.From = new MailAddress(ConfigurationManager.AppSettings[Constants.SENDERMAILADDRESS].ToString());
msg.To.Add(to);
msg.Subject = subject;
msg.Body = body;
msg.IsBodyHtml = true;

smtp.Send(msg);
flag = true;
}
catch (SmtpException smtpEx)
{
throw new Exception(ErrorMessages.Err_UnableToSendMail, smtpEx);
}
return flag;
}

In Web.config file Add

<add key="SMTPServerAddress" value="10.6.12.12" />
<add key="SenderMailId" value="vivek@yahoo.com" />

4 2489
vivek kapile
17 New Member
public static bool SendMail(string to,string subject,string body)
{
bool flag = false;
try
{
MailMessage msg = new MailMessage();
SmtpClient smtp = new SmtpClient(ConfigurationManager.AppSettings[Constants.SMTPSERVERADDRESS].ToString());
msg.From = new MailAddress(ConfigurationManager.AppSettings[Constants.SENDERMAILADDRESS].ToString());
msg.To.Add(to);
msg.Subject = subject;
msg.Body = body;
msg.IsBodyHtml = true;

smtp.Send(msg);
flag = true;
}
catch (SmtpException smtpEx)
{
throw new Exception(ErrorMessages.Err_UnableToSendMail, smtpEx);
}
return flag;
}

In Web.config file Add

<add key="SMTPServerAddress" value="10.6.12.12" />
<add key="SenderMailId" value="vivek@yahoo.com" />
Mar 23 '11 #2
Brian Connelly
103 New Member
Do i need an STMP server? I have a host. How do I use my IP? Is that the same as SMTP?
Mar 27 '11 #3
vivek kapile
17 New Member
Hi Brian,
SMTP server is different and your IP is different,SMTP you will get in a controls panel of the server.
Suppose you upload your site on a server, so the smtp address of that server.I think you use this address, it will work, it is default address "smtp.gmail.com" use and try to send a mail.
SmtpMail.SmtpServer = "smtp.gmail.com";
SmtpMail.Send( mail );
Mar 28 '11 #4
Brian Connelly
103 New Member
Thank you! That helps with understanding.
Mar 28 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jason Gates | last post by:
Dear all I have written a very complex web app for intranet use. It allows users to search a large database and then returns formatted results. I am currently employing a method as below: 1....
0
by: Andrew Crook | last post by:
have multiple domains on winodws 2003 (IIS) what best way to setup mysql i would like a limit on each domain on the number of databases if possible (see other post), if not i gues i will have to...
131
by: Peter Foti | last post by:
Simple question... which is better to use for defining font sizes and why? px and em seem to be the leading candidates. I know what the general answer is going to be, but I'm hoping to ultimately...
5
by: Joe Kasta | last post by:
Hi, I'm trying to determine what the proper way to create objects would be in C# (or any language, practically). There are two different ways of implementing objects that I can see, and I hope...
9
by: Mis Dep. | last post by:
Dear all What is Create GUID on menu Tools in vb.net and how can i use it for something . as exsample Brg, TingN@ng
2
by: Ronald S. Cook | last post by:
What is the best way to structure my Windows form so that when it is dragged bigger (i.e. maximized) or smaller, the controls will reorganize themselves "properly"? Assume I have 4 logical...
0
by: juglesh | last post by:
Hello, I've searched and d/l'd but cant seem to find a way of creating a semi-transparent drop shadow for an image. Let me say, be fore I go on, I *do not* want one of those scripts that resizes...
8
by: Claus | last post by:
Hi all, I am new to C#, .NET and Visual Studio but I have been coding professionally for more than 10 years, so I am not a complete newbe :-) At my work we are now in the process of switching...
5
by: Steven W. Orr | last post by:
I have two seperate modules doing factory stuff which each have the similar function2: In the ds101 module, def DS101CLASS(mname,data): cname = mname+'DS101' msg_class = globals() msg =...
2
by: ncsthbell | last post by:
I am just not sure the most efficient way to handle this. I have never used Adobe other than to open a document and read it! I have had Adobe Pro 8 installed on my machine to accomodate this...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.