Click here to Skip to main content
15,915,603 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am geeting an error while sending SMTP email in asp.net.
Error : The "SendUsing" configuration value is invalid."
Please help me out
Posted

Can you post your code over here,so that we can help you.

You can try this,


C#
MailMessage mail = new MailMessage();
                mail.To.Add("abc@gmail.com");
                mail.To.Add("xyz@yahoo.com");
                mail.From = new MailAddress("pqr@yahoo.com");
                mail.Subject = "Send email";
 
                string Body = "Here we are testing";
                mail.Body = Body;
                Attachment at = new Attachment("c:\\a.docx");
                mail.Attachments.Add(at);
 
                mail.IsBodyHtml = true;
                
                SmtpClient smtp = new SmtpClient("localhost",25);
                smtp.Host = "smtp.gmail.com";  
                smtp.Credentials = new System.Net.NetworkCredential
                     ("abc@gmail.com", "mygmailpassword");
                
                smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                smtp.EnableSsl = true;
                
                smtp.Send(mail);
                Label1.Text = "Mail has been sent";
 
Share this answer
 
v2
Comments
NareshChingu 25-Mar-13 5:48am    
I am using function with paramters
public static void SendMail(string mailFrom, string subject, string body, string mailTo, string mailCc, string mailBcc)
{}
And the code inside this function is:

MailMessage mailMsg = new MailMessage();
mailMsg.From = mailFrom;
mailMsg.To = mailTo;
mailMsg.Subject = subject;
mailMsg.Body = body;
mailMsg.Cc = mailCc;
mailMsg.Bcc = mailBcc;
mailMsg.BodyFormat = MailFormat.Html;

SmtpMail.Send(mailMsg);
Dhananjay Borde 29-Mar-13 11:32am    
But which SMTP you are using. You have to use SMTP server like gmail or any.
If you are using same server i.e. localhost then configure it properly.
It will work.
May be SMTP is not configured or you using some wrong values for it or may be you are using some other namespaces. Please provide some code to figure out the problem.
 
Share this answer
 
Comments
NareshChingu 25-Mar-13 5:48am    
I am using function with paramters
public static void SendMail(string mailFrom, string subject, string body, string mailTo, string mailCc, string mailBcc)
{}
And the code inside this function is:

MailMessage mailMsg = new MailMessage();
mailMsg.From = mailFrom;
mailMsg.To = mailTo;
mailMsg.Subject = subject;
mailMsg.Body = body;
mailMsg.Cc = mailCc;
mailMsg.Bcc = mailBcc;
mailMsg.BodyFormat = MailFormat.Html;

SmtpMail.Send(mailMsg);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900