need help: sending mail using

hi thr.. i am some help urgently.. i need to send mail using the cs code is


        System.Net.Mail.MailMessage MyMail = new System.Net.Mail.MailMessage();
        SmtpClient SmtpMail = new SmtpClient();
                MyMail.From = new MailAddress("");
               // for (int i = 0; i < GridView6.Rows.Count; i++)
                    MyMail.To.Add(new MailAddress(""));
                //MyMail.Bcc.Add(new MailAddress(""));
                MyMail.Subject = "Assessment";
                MyMail.Body ="hi";
                MyMail.IsBodyHtml = true;///False; //If you want your mail looks like html then set true other false to look like simple text
                SmtpMail.Host = "";//"";
                SmtpMail.Port = 25;

            catch (Exception exx)
                Label1.Text = exx.ToString();



and in web config i have


<?xml version="1.0"?>
      <smtp from="">
        <network host="" port ="25"/>


but the mail is stuck in the C:\Inetpub\mailroot\Queue folder..

pls tel me wht hav i done wrong.. thanks in advance.. 

8/3/2008 10:07:49 AM 91979 articles. 3 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 1

You can send email using gmail port and your gmail userid

Try this it works for me. 

using System.Net.Mail;

System.Net.NetworkCredential mailAuthentication = new System.Net.NetworkCredential("your gmail email address","your password");

System.Net.Mail.SmtpClient MailObj = new System.Net.Mail.SmtpClient("", 587);

MailObj.EnableSsl = true;

MailObj.UseDefaultCredentials = false;

MailObj.Credentials = mailAuthentication;

string toName = TextTo.Text;

 string FrName = TextFrom.Text;

 MailMessage mm = new MailMessage(FrName,toName);

mm.Body = TextBody.Text;

mm.Subject = TextSub.Text;

mm.IsBodyHtml = false;


Label1.Text="Mail Sent Successfully..................";


catch (Exception ex)


Label1.Text = ex.ToString();



In Web.Config



<smtp from="your gmail email address">

<network host="" password="urpassword" port="587"

userName="your gmail email address" />




make sure when you execute your code your system is connected to internet.  

Please Mark me as answer if this help you.

All the Best

8/3/2008 2:20:53 PM

Similar Artilces:

Why do Sending SMTP Authenticated E-mail succeed using SmtpMail.Send() function but fail using SmtpClient.send() function ? Bugs in System.Net.Mail.SmtpClient when send a Authenticated E-mail?
I click btnOK button, the email can send OK, but click btnFail button,  the following error is displayed! why ? you can test the section code. The SMTP, username, password are valid!  Many thanks! "Syntax error, command unrecognized. The server response was: authentication failed,decode user password error" I have tested some other SMTP, somes is OK. I think there are some bugs with System.Net.Mail.SmtpClient when send a Authenticated E-mail with some SMTP!   //------------------------------------------.ASPX Code----------------------------------------...

Sending Mail Using System.Net.Mail with out using User credentials
HI, I have an application where in i send mails based on some condition, the user is already authenticated, so i need not check the User Credentials.Right now this is how the piece lokks:- mailClient.Credentials = new NetworkCredential(USERID, USER_PWD,DOMAIN); I want to send the mail, with out validating the user credentials, Can i skip the above line. Please post aqlong with the sample code.   Thanx in Advance. Anil Kumar.   I think you cannot skip. but store user credentials in session variables after login and then pass.If this post was useful to you, please mark it as...

get mail using System.Net.Mail
How can i get Email usign System.Net.Mail ?? Hello poloxy  ,the System.Net.Mail used only for sending emails and not to receive them.Read the full documentation at  MSDN Library  Hosam Kamel Remember to click on Mark as answer on the post that helped you SO how can I receive mail ? Try one of these pop3 libraries  Hosam Kamel Remember to click on Mark as answer on the post that helped you HI,   if you want to send email by using System....

Problem in sending mail using
I am using C# and ASP.Net2.0 for sending mail. But my problem is it is not being sent. I am not being able to understand it. I am using my gmail account for it. I am using System.Net and System .Net.Mail for sending the same. But i am getting the error ''Failure Sending Mail. Cannot connect to the server" . I have internet connection. Plz help me. It's urgent. I am attaching my code.  MailMessage mailMsg = new MailMessage();MailAddress ma = new MailAddress(; mailMsg.From = ma; mailMsg.To.Add(s);mailMsg.Subject = "Your...

.net 2 beta 2 - System.Net.Mail
Hi guysI'm using the System.Net.Mail namespace in .net version 2, beta 2, to send out some HTML formatted e-mails.However, for some reason when the e-mail are sent out some of the full stops from the e-mail are removed.For example, part of the e-mail contains this code<img src="" alt="">But this is what the code is like when the e-mail source code is viewed<img src="" alt="">Is this a known bug in beta 2? If so, where can I view a list of known bugs an...

What is the maximum size of attachement in sending mail using
I am able to send mail with attachement using System.Net.Mail. But I want to know the maximum size limit of aatchement. Thanks, Prashant It depends on your smtp server settings  MAKMark as Answer if this reply helps youMVP ASP/ASP.NetASP.Net Hosting : Host DepotMy Site : ASPSnippets Hello Mudassar Khan, Thank you very much for your reply.  Where and how to set this setting in my SMTP server???? And one more thing I want to know that there is any limit of the message body size or message size that can be sent using   Thanks, P...

How to send Mail using System.Net.Mail outside the company network?
Hi All, I am trying to send mail to my ( account, but its not going and throwing error like "Mailbox unavailable. The server response was: <> No such user here". Its working fine if i will send to our company ids. Please help me out. Code: SmtpClient smtp = new SmtpClient();smtp.Host = ""; smtp.Port = 25; //smtp.Credentials = CredentialCache;MailMessage msg = new MailMessage();MailAddress from = new MailAddress(txtFrom.Text); msg.Sender = from; msg.From = from;  string[] tos = txtTo.Text...

How to send e-mail to invalid address using System.Net.Mail.MailMessage
Hi all,i need create MailMessage with invalid address. It is posible? I need send mail to smtp server with MailMessage.To = "[FAX: ...fax number.....]". Thanks all for any help! p.s.: sorry for my english.  It can't be an invalid email address, but if you run a fax server the email address in the fax server syntax should work fine. JeffPlease: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.... not sending out mail
I recently upgraded from a 2.0 framework to 3.5 using c#.  When I upgraded, I needed to change the way I was using MailMessage.  But now for some reason it doesn't work.  Am I missing something?Below is my code:using; MailMessage msg = new MailMessage();msg.To.Add(toList);msg.CC.Add(ccList = null ? "" : ccList);msg.From = new MailAddress(fromList);msg.Subject = subject;msg.Body = body;msg.IsBodyHTML = true; SmtpClient smtp = new SmtpClient(smtpServer);smtp.Send(msg); I'm passing all the value from my web.config file inside AppSettings.What ...

About: how can i send a MIME(Text und Html Format) Mail by System.Net.Mail und .Net 2.0
Helle to all, I hope that someone can help me. I need to implement a programm to send newsletters. The newsletter Format can be Html, Text and MIME(Html and Text). when using CDONTS library man can set MailFormat = MIME. But i use System.Net.Mail and there are only text or html Format. Can someone tell me how can i use System.Net.Mail to send a MIME Mail? Thanks Best Regards Pinsha perhaps this link can help: this world there are 10 types of people, those that know binary and those who don't....

What additional advantage we get through over the old system.web.mail?
What additional advantage we get through over the old system.web.mail?Is it needed to configure the smtp server? Plz tell me the steps to develop the email sending facility in our applicationSwati Jain Take a look at Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue....

Problem with difference between System.Web.Mail and System.Net.Mail in using attachments
I have a web .Net app which sends emails with attachments.  After the email is sent I clean up aftermyself and delete the attachments from disk.   In upgrading to .Net 2  I changed the email logic from using system.web.mail to  (of course vs is telling me system.web.mail is obsolete).In .Net 1.1,  the files deleted with no problem but in .Net 2 when I attempt to delete  I receive The process cannot access the file ...' because it is being used by another process. If I change the code back to using system.web.mail I can delete the file...

Sending Email through System.Net.Mail is generating errors "Failure Sending mail
hi Sending Email through System.Web.Mail is working fine but System.Net.Mail is generating errors "Failure Sending mail  i treid in all possible ways but did't  pls help in giving a solution thanks & Regards vittal Maybe you can show us some code and post the exact error mesg as well (by looking at the value in ex.tostring)?My HomePage -"It is more blessed to give than to receive." Acts 20: 35 (NIV, Bible)Progress - "Never discourage anyone...who continually makes progress, no matter how slow." Plato System.Web.Ma...

Help for Visual web dev isolate system.web.mail to
Hi all,  I'm new user to visual web developer express software. Laterly i found this application isolate quite some of the component namespace, like system.web.mail to net.mail. I not well understand how functional?? Does it act same as system.web.mail?? My coding below: change system.web.mail to which causing a lot error... *****Can anybody correct me or advise me how to make this code work in <%@import Namespace="" %> <script runat="server">    Public FromAddress As String = "" .......

Web resources about - need help: sending mail using -

Sending/receiving relationship - Wikipedia, the free encyclopedia
A sending/receiving relationship is one in which a public school district sends some or all of its students to attend the schools of another ...

U.K. Woman Faces 20 Months For Creating Fake Facebook Accounts, Sending Herself Abusive Messages
A woman in Cornwall in the U.K. came up with a creative way to use Facebook to accelerate a family spat, and it earned her 20 months in prison. ...

CHVRCHES - Dear guys, Please stop sending us emails like... - Facebook
Dear guys, Please stop sending us emails like this. This is one of the more polite ones. Other recent classics include "I'm going to give her ...

[...] Facebook Prevents Users From Sending Suspicious Friend Requests To Strangers, Inside Facebook [...] ...
Facebook has begun implementing new security measures to prevent friend request spamming. Some users are being shown a “This Request Can’t Be ...

A better experience for sending Tweets and DMs - Twitter Blog
... panel New Tweet panel in da...... Skip to main content Blog Got an account? Sign in Search form Search &nbsp A better experience for sending ...

How to Go From Working 60 Hours a Week to 40 By Sending 2 Emails a Week
I’m convinced 95% of cubicle workers who work over 60 hours a week constantly can cut it down to 40-45 hours by sending 2 emails a week to their ...

Emoticon and Emoji Box for iPhone -Save Emoticons,emoji,pic and images for Sending Message! 200 FREE ...
Get Emoticon and Emoji Box for iPhone -Save Emoticons,emoji,pic and images for Sending Message! 200 FREE emoticons and emojis - on the App Store. ...

Thanks for sending an iPhone4 and Sim T-Mobile but ... - Flickr - Photo Sharing!
... that's probably not going to work. (also, I'm sticking with the iPod touch).

Texas Man Makes $10K A Month Sending Potatoes With Personalized Messages In The Mail! - YouTube
Alex Craig, 24, said he came up with the idea for Potato Parcel earlier this year while having dinner with his girlfriend. His girlfriend called ...

'It was scary': widow speaks out as Muslim cleric pleads guilty to sending offensive letters to families ...
The young widow of fallen Australian soldier Brett Till still recalls the fear that came after she opened a letter sent to their home that labelled ...

Resources last updated: 12/11/2015 8:05:09 PM