473,386 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

sending emails

26
Hi, I am having a gridview which contains a hyperlink template field which is bound to show the email address of the employees.Now when i click the hyperlink feild in the gridview i want to send an email to the selected employee.
I am new to asp.net....Plz if anyone can tell me how this could be done......
Thnks .
Mar 4 '09 #1
9 1671
hiiiiii
use this :
Dim objMail As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage


objMail.To = "bhupinder@owt.cc"

objMail.From = "shikha@owt.cc"
objMail.Subject = "hi"

objMail.Body = "fdbsfdsfv"
objMail.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = ConfigurationManager.AppSettings("SMTP")

SmtpMail.Send(objMail)




And also add a key named "SMTP" in your web config and give it value of your server e.g.

<add key="SMTP" value="192.168.0"/>
Mar 4 '09 #2
Ria12
26
I m working in C#.Code is almost the same,but with this code Mail is being sent but it's not being received ...can u Plz Check the Code...

using System.Net.Mail;

MailMessage msg = new MailMessage(txtFrom.Text, txtTo.Text, txtsub.Text, txtMsg.Text);
SmtpClient mySmtp = new SmtpClient("localhost");
try
{
mySmtp.Send(msg);

Response.Write("Mail Sent");
}
catch (Exception ex)
{
Response.Write(ex);
}.

plz help me. I need it urgently.
thanks
Mar 4 '09 #3
hiiiiiii
Use mail message like this:
MailMessage msg = new MailMessage();
msg .To = txtTo.Text;
msg .From =txtFrom.Text;
msg .Subject =txtsub.Text;
msg .Body = txtMsg.Text;
msg .BodyFormat = System.Web.Mail.MailFormat.Html;
Mar 4 '09 #4
Ria12
26
There are many Errors like Web.Mail is obsolete....Plz can u Explain me what i have to use to send mail in asp.net C#...
Mar 4 '09 #5
MailMessage msg = new MailMessage();
msg .To = txtTo.Text;
msg .From =txtFrom.Text;
msg .Subject =txtsub.Text;
msg .Body = txtMsg.Text;

SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["SMTP"].ToString();
SmtpMail.Send(msg);


Add SMTP key in your web config like this in <appsettings> tag
<appsettings>
<add key="SMTP" value="localhost"/>
</appsettings>

And add
using System.Web.Mail instead of using System.Net.Mail;
Mar 4 '09 #6
Ria12
26
Hi......Thks for yur help.
Its not showing any errors now, but the email is not being recieved.
I dont know where i m going wrong ...Are there any other settings which i have to make. For eg.When i send the email from xyz@gmail.com to abc@gmail.com the email is not recieved.
Thanks ......again.
Mar 4 '09 #7
You cannot send mail from localhost smtp server to online mail ids like yahoo, gmail....... For this you have to change your smtp value from localhost to your online server value
Mar 4 '09 #8
Ria12
26
I have tried alot,my mail's r in Drop folder of mailroot when i send to localhost ...but when try to send on yahoo or gmail...they r in Bad folder...can u plz guide me what settings i have to do it in asp.net 2.0?
Mar 6 '09 #9
@Ria12
Hiiiiiiiiiiiiii Ria12
You cant send yahoo or gmail in ur local host. bec. this is live server. u have only local server.
Mar 6 '09 #10

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

Similar topics

1
by: dan glenn | last post by:
I'm creating HTML emails from a PHP site and sending them out to an email list (just about 40 people so far are on this list). I've tested and confirmed that these emails work in yahoo.com's...
10
by: Stuart Mueller | last post by:
I have an exchange server, that I sometimes use to perform mail shots to clients on our database, these can be upwards of 1000 at a time. As we don't want different clients to see who we are...
1
by: Ian Taylor | last post by:
Hi all... Is it possible to send RTF-formatted emails using the .NET SmtpMail implementation? I can only find provision in the BodyFormat property of the message to send plain text or HTML...
3
by: VB Programmer | last post by:
My company has it's own webserver, which is going to host our ASP.NET web application. We want the website to be able to send out emails. 1. What do I need on the server so that it has the...
2
by: Mr. x | last post by:
Hello, I am sending emails with Hebrew contents. When receiving emails - I cannot see the Hebrew characters (it is not outlook express configuration, because when receiving emails from friends -...
3
by: Ant | last post by:
Hi, I'm using the MailMessage & smtpMail classes in System.Web.Mail to send mail, however it's not sending any emails. I'm using it on a Windows 2003 server. The simplest way to use this is...
5
by: Kun | last post by:
i have the following code: ---------------------------------- import smtplib from email.MIMEText import MIMEText fp = open('confirmation.txt', 'rb') msg = MIMEText(fp.read()) From =...
5
by: Jai | last post by:
Hi, I am in a problem of sending mass emails(newsletter) to my website members. Actually my problem is this: I want to send newsletter to my website members. But I had given a facility for...
1
by: robbiesmith79 | last post by:
Just so this is out there on the web, I battled the past 24 hours about this. Background info... I developed a ecommerce website in PHP 4 on a shared linux hosting plan from GoDaddy and had the...
2
by: lstanikmas | last post by:
Hi, I'm validating a form with this ASP but receiving some blank email responses; does anyone see anything wrong with it?: function isFormVarExcluded(thisForm, strToCheck) { var strExcludeVars...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.