Umbraco联系表格 [英] Umbraco Contact Form
本文介绍了Umbraco联系表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
以下联系表格适用于vs 2010,通常用于创建应用程序.除了应用程序源代码:
Hey All,
Following contact form works in vs 2010, typically create application. In addition to application source code:
Name:
<asp:TextBox ID="txtName" runat="server" />
Email:
<asp:TextBox ID="txtEmail" runat="server" />
Message:
<asp:TextBox ID="txtContent" runat="server" TextMode="MultiLine" />
<asp:Button ID="btnSubmit" runat="server" Text="Send Email"
onclick="btnSubmit_Click" />
和背后的代码:
DDL:
and Code Behind:
DDL:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Net.Mail;
protected void btnSubmit_Click(object sender, EventArgs e)
{
MailMessage message = new MailMessage();
message.To.Add("youremail@yahoo.com");
message.Subject = txtName.Text + " sent you a message via contact form";
message.From = new MailAddress(txtEmail.Text);
message.Body = txtContent.Text;
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
client.Credentials = new NetworkCredential("youremail@yahoo.com", "yourpassword");
client.EnableSsl = true;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Send(message);
client.EnableSsl = true;
}
问题是,为什么在Umbraco CMS中不起作用?
谢谢
Jovan
The question is, Why does not work in Umbraco CMS?
Thank you,
Jovan
推荐答案
我每天都与Umbraco合作,在发送电子邮件时并没有给我带来任何问题.也许您的服务器未配置为发送电子邮件?也许防火墙阻止了电子邮件?
使用try/catch块来捕获可能发生的任何异常,并将它们输出到页面.另外,请确保您的点击处理程序实际上正在运行.当我无法在Visual Studio中调试Umbraco时,通常会使用类似的简单技术来获取调试信息.
I work with Umbraco every day, and it hasn''t caused me any issues when sending email. Perhaps your server is just not configured to send email? Maybe a firewall is blocking email?
Use a try/catch block to catch any exceptions that may occur, and output them to the page. Also make sure your click handler is actually being run. When I can''t debug Umbraco in Visual Studio, I typically use simple techniques like that to get debugging info.
我不确定,但是找到了一个可能对您有帮助的链接.
Umbraco的简单联系表单模板 [ ^ ] .
对不起,如果我错了...
谢谢...
I am not sure, but found one link which may be helpful for you.
Simple Contact Form Template For Umbraco[^].
Sorry if I am wrong...
Thanks...
这篇关于Umbraco联系表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文