Form Builder with email
Does this exist in Sitefinity 4.4? Nice to have forms but how come it can't send emails? Is there a control available in the market place? or an example how how to do this otherwise?
Hello Nimit,
Thank you for contacting support.
There is tutorial plus sample project available in this blog post for forms e-mail notifications.
For the subscribe form:
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Net.Mail;
using
Telerik.Sitefinity.Configuration;
using
Telerik.Sitefinity.Services;
using
System.Text;
using
Telerik.Sitefinity.Web.Mail;
using
System.ComponentModel;
namespace
SitefinityWebApp
public
class
Class1 : Telerik.Sitefinity.Modules.Newsletters.Web.UI.Public.SubscribeForm
protected
override
void
InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container)
base
.InitializeControls(container);
this
.SubscribeButton.Click +=
new
EventHandler(Class1_BeforeFormAction);
private
void
Class1_BeforeFormAction(
object
sender, EventArgs e)
var smtpSettings = Config.Get<SystemConfig>().SmtpSettings;
MailMessage message =
new
MailMessage();
message.From =
new
MailAddress(smtpSettings.DefaultSenderEmailAddress);
message.To.Add(
new
MailAddress(
"user@telerik.com"
));
StringBuilder sb =
new
StringBuilder();
sb.AppendFormat(
"You have one new form response on form. The response is sent from IP address"
);
message.Subject =
"Forms notification"
;
message.Body = sb.ToString();
message.IsBodyHtml =
true
;
message.BodyEncoding = Encoding.Unicode;
message.SubjectEncoding = Encoding.Unicode;
EmailSender.Get().Send(message);