Imports BVSoftware.BVC.Core Imports System.Web.Mail Public Class EmailFriend1 Inherits BaseStorePage Protected WithEvents valSummary As System.Web.UI.WebControls.ValidationSummary Protected WithEvents lblErrorMessage As System.Web.UI.WebControls.Label Protected WithEvents lblResults As System.Web.UI.WebControls.Label Protected WithEvents inEmail As System.Web.UI.WebControls.TextBox Protected WithEvents valEmail As System.Web.UI.WebControls.RequiredFieldValidator Protected WithEvents valEmail2 As System.Web.UI.WebControls.RegularExpressionValidator Protected WithEvents btnSend As System.Web.UI.WebControls.ImageButton Protected WithEvents MetaDescriptionControl As BVSoftware.WebControls.MetaTag Protected WithEvents MetaKeywordsControl As BVSoftware.WebControls.MetaTag Protected WithEvents inMessage As System.Web.UI.WebControls.TextBox Protected WithEvents pnlMain As System.Web.UI.WebControls.Panel Protected WithEvents pnlRegister As System.Web.UI.WebControls.Panel Protected WithEvents FromEmailField As System.Web.UI.WebControls.TextBox Protected WithEvents Requiredfieldvalidator1 As System.Web.UI.WebControls.RequiredFieldValidator Protected WithEvents Regularexpressionvalidator1 As System.Web.UI.WebControls.RegularExpressionValidator Protected WithEvents CSSTag1 As BVSoftware.WebControls.CSSTag #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then MetaKeywordsControl.Content = WebAppSettings.MetaKeywords MetaDescriptionControl.Content = WebAppSettings.MetaDescription CSSTag1.StyleSheetURL = PersonalizationServices.GetPersonalizedStyleSheet PageTitle = "Email Page" btnSend.ImageUrl = ImageHelper.GetThemedButton("Submit.gif") inMessage.Text = "" & Request.Params("page") & "" If BVC2004Store.IsUserAuthenticated = True Then Me.FromEmailField.Text = BVC2004Store.GetCurrentUser.Email End If Me.pnlMain.Visible = True Me.pnlRegister.Visible = False 'Else 'Me.pnlMain.Visible = False 'Me.pnlRegister.Visible = True 'End If Me.valEmail.Text = ImageHelper.GetErrorIconTag Me.valEmail2.Text = ImageHelper.GetErrorIconTag Me.Requiredfieldvalidator1.Text = ImageHelper.GetErrorIconTag Me.Regularexpressionvalidator1.Text = ImageHelper.GetErrorIconTag End If End Sub Sub btnSend_OnClick(ByVal Sender As Object, ByVal E As ImageClickEventArgs) lblErrorMessage.Text = "" lblResults.Text = "" If Page.IsValid Then 'Dim CurrentUser As Membership.UserAccount 'CurrentUser = BVC2004Store.GetCurrentUser Dim MyMessage As New MailMessage MyMessage.To = HttpUtility.HtmlEncode(inEmail.Text) MyMessage.From = HttpUtility.HtmlEncode(FromEmailField.Text) MyMessage.BodyFormat = MailFormat.Html MyMessage.Body = "" MyMessage.Body += System.Environment.NewLine & "
" MyMessage.Body += "A friend has sent you a link to a page at " & WebAppSettings.SiteName & ":" MyMessage.Body += System.Environment.NewLine & "
" MyMessage.Body += System.Environment.NewLine & "
" MyMessage.Body += System.Environment.NewLine & "
" MyMessage.Body += inMessage.Text MyMessage.Body += System.Environment.NewLine & "
" MyMessage.Body += System.Environment.NewLine & "
" MyMessage.Body += "" MyMessage.Subject = "Link From " & HttpUtility.HtmlEncode(FromEmailField.Text) If MailServices.SendMail(MyMessage) = False Then lblErrorMessage.Text = "Error while sending mail!" Else Me.lblResults.Text = "Message Sent!" End If MyMessage = Nothing End If End Sub Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSend.Click End Sub End Class