473,387 Members | 1,673 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,387 software developers and data experts.

asp.net : c#.net : difficulty in sending emails

when i use the code :
Expand|Select|Wrap|Line Numbers
  1. private void Report(int var)
  2.     {
  3.         var++;
  4.         String ToEmail = "";
  5.         String FromEmail = "";
  6.         String Bdy = "";
  7.         ToEmail = System.Configuration.ConfigurationManager.AppSettings["EmailReportTo"];
  8.         FromEmail = System.Configuration.ConfigurationManager.AppSettings["EmailReportFrom"];
  9.         Bdy = var.ToString();
  10.         try
  11.         {
  12.         SmtpMail.Send(FromEmail, ToEmail,"value",Bdy);
  13.         Response.Write("Your Email has been sent sucessfully");
  14.         }
  15.         catch (Exception exc)
  16.         {
  17.         Response.Write("Send failure: " + exc.ToString());
  18.         }
  19.     }
  20.  
the output shows that the email has been send but no email is received on the ToEmail address

when i use :
Expand|Select|Wrap|Line Numbers
  1.  
  2. private void Report(int var)
  3.     {
  4.         var++;
  5.         String ToEmail = "";
  6.         String FromEmail = "";
  7.         String Bdy = "";
  8.         String ServerName = "";
  9.         ServerName = System.Configuration.ConfigurationManager.AppSettings["SMTPServerName"];
  10.         ToEmail = System.Configuration.ConfigurationManager.AppSettings["EmailReportTo"];
  11.         FromEmail = System.Configuration.ConfigurationManager.AppSettings["EmailReportFrom"];
  12.         Bdy = var.ToString() ;
  13.         System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
  14.         message.To.Add(ToEmail);
  15.         System.Net.Mail.MailAddress address = new System.Net.Mail.MailAddress(FromEmail);
  16.         message.From = address;
  17.         message.Subject = "value"; 
  18.         message.Body = Bdy;
  19.         System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(ServerName);
  20.         smtp.Port = 25;
  21.         try
  22.         {
  23.             smtp.Send(message);
  24.             Response.Write("Your Email has been sent sucessfully");
  25.         }
  26.         catch (Exception exc)
  27.         {
  28.             Response.Write("Send failure: " + exc.ToString());
  29.         }
  30.  
  31.     }
  32.  
  33.  
it shows the exception :
Send failure: System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: 5.7.1 Unable to relay for vishal@yahoo.co.in at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at _Default.ReportSpamBot(Int32 var)

somebody please help as to how should i send the emails??
Jan 3 '08 #1
2 1183
nateraaaa
663 Expert 512MB
It sounds like Yahoo is viewing the email you are sending as SPAM. Yahoo then returns an email telling you that the mailbox in unavailable. Try turning off SPAM control in Yahoo and try sending again.

Nathan
Jan 3 '08 #2
i ried sending to gmail too but the mails do not reach..

if my code is right then why are the mails not reaching any of the specified email addresses....
Jan 4 '08 #3

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...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
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.