Click here to Skip to main content
15,906,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my application I want to send mail.

it was working currently in one server (domain), but it is not working change the (domain) server why this problem?
Is smtp different for different server or domain?

My code is
DataSet ds = new DataSet();
            MailMessage mail1 = new MailMessage();
            mail1.From = txtemail.Text;
            mail1.To = ds.Tables[0].Rows[0][0].ToString();

            mail1.Body = "Sender : " + txtemail.Text + "\n" + "Name : " + txtname.Text + "\n" + "Phone : " + txtPhone.Text + "\n" + "\n" + "Sub:" + txtsubject.Text + "\n" + "Body :" + txtmsg.Text;
            SmtpMail.SmtpServer.Insert(0, "");

My question is, is SmtpMail.SmtpServer.Insert(0, "") different for different server or site or domain.

My error is The "SendUsing" configuration value is invalid.
Updated 24-Oct-11 21:40pm
Dalek Dave 25-Oct-11 3:41am    
Edited for Spelling and Readability.

Check your SMTP IP-Address is accessible from your new Domain/Server.

Run "ping" command from command-prompt of your new Server.
Share this answer
System.Net.Mail.MailMessage obj = new System.Net.Mail.MailMessage();
     SmtpClient serverobj = new SmtpClient();
            serverobj.Credentials = new NetworkCredential("", "yourpassword");
            serverobj.Port = 587;
            serverobj.Host = "";
            serverobj.EnableSsl = false;
            obj = new System.Net.Mail.MailMessage();
            obj.From = new MailAddress("YourEmailId", "", System.Text.Encoding.UTF8);
            obj.Priority = System.Net.Mail.MailPriority.High;
            obj.Subject = txtSubject.Text;
            string date = DateTime.Now.ToString();
            obj.Body = ASPxMemo1.Text;
            lblsend.Text = "Your Message Send Sucessfully";

Its Works


Share this answer
$ultaNn 30-Mar-13 3:28am    
i am getting this error The specified string is not in the form required for an e-mail address.
near SmtpClient serverobj = new SmtpClient();
Share this answer
take a look
Send Mail
Share this answer
The chances are that you need to set the authorisation credentials for the new domain.

There is a generic routine which may help you here: Sending an Email in C# with or without attachments: generic routine.[^]
Share this answer

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