Asp.net联系表格没有正确提交价值

时间:2017-12-14 05:31:56

标签: asp.net

我的网站有联系表格,客户填写他们的详细信息并发送联系方式和消息,因为我使用域名电子邮件将填写的详细信息发送到我的收件箱。形式工作良好,但问题是当详细信息来到我的收件箱时它的外观如下:名称 - 5a313471b73da,移动号码''''''等等。

还有一件事对我的国家有用,所有的细节都会出现在我的收件箱中,但是当从其他国家提交时,这个问题就要来了......

这是我的代码......

              //Gmail Address from where you send the mail
                var fromAddress = System.Configuration.ConfigurationManager.AppSettings["FromEmailId"].ToString();
                // any address where the email will be sending
                var toAddress = "email";
                //Password of your gmail address
                string fromPassword = System.Configuration.ConfigurationManager.AppSettings["FromPwd"].ToString();
                // Passing the values and make a email formate to display
                string subject = "Enquiry";

                // smtp settings
                MailMessage Msg = new MailMessage();
                MailAddress fromMail = new MailAddress(fromAddress);
                // Sender e-mail address.
                Msg.From = fromMail;
                // Recipient e-mail address.
                Msg.To.Add(new MailAddress("email"));
                // Subject of e-mail
                Msg.Subject = "Enquiry";
                string body = "Name - " + name.Text.ToString() + "\n";
                body += "Email Id -" + emailId.Text.ToString() + "\n";
                body += "Contact No -" + Phone.Text.ToString() + "\n";
                body += "Subject -" + Subject.Text.ToString() + "\n";
                body += "Message -" + message.Text.ToString() + "\n";



                Msg.IsBodyHtml = true;

                var smtp = new System.Net.Mail.SmtpClient();
                {
                    smtp.Host = "smtpout.secureserver.net";
                    smtp.Port = 3535;                   
                    smtp.EnableSsl = false;
                    // smtp.UseDefaultCredentials = false;
                    smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
                    smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
                    smtp.Timeout = 200000;

                }

                smtp.Send(fromAddress, toAddress, subject, body);

0 个答案:

没有答案