when i use the code :
[code=cpp]
private void Report(int var)
{
var++;
String ToEmail = "";
String FromEmail = "";
String Bdy = "";
ToEmail = System.Configur ation.Configura tionManager.App Settings["EmailRepor tTo"];
FromEmail = System.Configur ation.Configura tionManager.App Settings["EmailReportFro m"];
Bdy = var.ToString();
try
{
SmtpMail.Send(F romEmail, ToEmail,"value" ,Bdy);
Response.Write( "Your Email has been sent sucessfully");
}
catch (Exception exc)
{
Response.Write( "Send failure: " + exc.ToString()) ;
}
}
[/code]
the output shows that the email has been send but no email is received on the ToEmail address
when i use :
[code=cpp]
private void Report(int var)
{
var++;
String ToEmail = "";
String FromEmail = "";
String Bdy = "";
String ServerName = "";
ServerName = System.Configur ation.Configura tionManager.App Settings["SMTPServerName "];
ToEmail = System.Configur ation.Configura tionManager.App Settings["EmailRepor tTo"];
FromEmail = System.Configur ation.Configura tionManager.App Settings["EmailReportFro m"];
Bdy = var.ToString() ;
System.Net.Mail .MailMessage message = new System.Net.Mail .MailMessage();
message.To.Add( ToEmail);
System.Net.Mail .MailAddress address = new System.Net.Mail .MailAddress(Fr omEmail);
message.From = address;
message.Subject = "value";
message.Body = Bdy;
System.Net.Mail .SmtpClient smtp = new System.Net.Mail .SmtpClient(Ser verName);
smtp.Port = 25;
try
{
smtp.Send(messa ge);
Response.Write( "Your Email has been sent sucessfully");
}
catch (Exception exc)
{
Response.Write( "Send failure: " + exc.ToString()) ;
}
}
[/code]
it shows the exception :
Send failure: System.Net.Mail .SmtpFailedReci pientException: Mailbox unavailable. The server response was: 5.7.1 Unable to relay for vishal@yahoo.co .in at System.Net.Mail .SmtpTransport. SendMail(MailAd dress sender, MailAddressColl ection recipients, String deliveryNotify, SmtpFailedRecip ientException& exception) at System.Net.Mail .SmtpClient.Sen d(MailMessage message) at _Default.Report SpamBot(Int32 var)
somebody please help as to how should i send the emails??
[code=cpp]
private void Report(int var)
{
var++;
String ToEmail = "";
String FromEmail = "";
String Bdy = "";
ToEmail = System.Configur ation.Configura tionManager.App Settings["EmailRepor tTo"];
FromEmail = System.Configur ation.Configura tionManager.App Settings["EmailReportFro m"];
Bdy = var.ToString();
try
{
SmtpMail.Send(F romEmail, ToEmail,"value" ,Bdy);
Response.Write( "Your Email has been sent sucessfully");
}
catch (Exception exc)
{
Response.Write( "Send failure: " + exc.ToString()) ;
}
}
[/code]
the output shows that the email has been send but no email is received on the ToEmail address
when i use :
[code=cpp]
private void Report(int var)
{
var++;
String ToEmail = "";
String FromEmail = "";
String Bdy = "";
String ServerName = "";
ServerName = System.Configur ation.Configura tionManager.App Settings["SMTPServerName "];
ToEmail = System.Configur ation.Configura tionManager.App Settings["EmailRepor tTo"];
FromEmail = System.Configur ation.Configura tionManager.App Settings["EmailReportFro m"];
Bdy = var.ToString() ;
System.Net.Mail .MailMessage message = new System.Net.Mail .MailMessage();
message.To.Add( ToEmail);
System.Net.Mail .MailAddress address = new System.Net.Mail .MailAddress(Fr omEmail);
message.From = address;
message.Subject = "value";
message.Body = Bdy;
System.Net.Mail .SmtpClient smtp = new System.Net.Mail .SmtpClient(Ser verName);
smtp.Port = 25;
try
{
smtp.Send(messa ge);
Response.Write( "Your Email has been sent sucessfully");
}
catch (Exception exc)
{
Response.Write( "Send failure: " + exc.ToString()) ;
}
}
[/code]
it shows the exception :
Send failure: System.Net.Mail .SmtpFailedReci pientException: Mailbox unavailable. The server response was: 5.7.1 Unable to relay for vishal@yahoo.co .in at System.Net.Mail .SmtpTransport. SendMail(MailAd dress sender, MailAddressColl ection recipients, String deliveryNotify, SmtpFailedRecip ientException& exception) at System.Net.Mail .SmtpClient.Sen d(MailMessage message) at _Default.Report SpamBot(Int32 var)
somebody please help as to how should i send the emails??
Comment