Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ $(window).load(function() {
<Rock:RockLiteral ID="ltEmailRecipients" runat="server"></Rock:RockLiteral>
<Rock:Toggle ID="cbEmailSendToParents" runat="server" OnText="Parents" OffText="Members" Label="Send To:"
OnCssClass="btn-primary" OffCssClass="btn-primary" Checked="false" OnCheckedChanged="cbEmailSendToParents_CheckedChanged" />
<Rock:RockDropDownList ID="ddlFrom" runat="server" Label="From Email:"></Rock:RockDropDownList>
<Rock:RockLiteral ID="ltFromEmail" runat="server" Label="From Email:"></Rock:RockLiteral>
<Rock:RockTextBox ID="tbSubject" runat="server" Label="Subject:"></Rock:RockTextBox>
<Rock:RockTextBox ID="tbBody" runat="server" TextMode="MultiLine" Rows="5" Label="Message:"></Rock:RockTextBox>
<Rock:BootstrapButton ID="btnEmailSend" runat="server" OnClick="btnEmailSend_Click" CssClass="btn btn-primary">Send</Rock:BootstrapButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ namespace RockWeb.Plugins.org_secc.GroupManager
[BooleanField( "Allow Email", "Allow email to be sent from this block.", false )]
[BooleanField( "Allow SMS", "Allow test messages to be sent from this block.", false )]

[TextField( "Safe Sender Email", "If the current users email address is not from a safe sender, the email address to use.", category: "Email Settings" )]
[DefinedTypeField( "Mail Relay Domain Blacklist", "The Defined Type containing the blacklist of restricted domains for relaying email.", false, key: "RestrictedDomains", category: "Email Settings" )]
[TextField( "From Email Help", "The help text for the \"From Email\" field", true, "Certain email providers (such as aol.com and yahoo.com) do not permit relaying email from your email address on our servers. Please select the email address you want this email to be sent from.", category: "Email Settings" )]
[TextField( "From Email Address", "The fixed From email address used for all emails sent from this block.", true, "", "Email Settings", 0, "SafeSenderEmail" )]
[TextField( "Table Number Attribute Key", "Set the Attribute Key of the Table Number group member attribute.", false )]

public partial class LWYARoster : GroupManagerBlock
Expand Down Expand Up @@ -272,34 +270,14 @@ protected void btnEmail_Click( object sender, EventArgs e )

DisplayEmailRecipients();

if ( GetAttributeValue( "SafeSenderEmail" ).IsNotNullOrWhiteSpace() )
var safeSenderEmail = GetAttributeValue( "SafeSenderEmail" );
if ( safeSenderEmail.IsNotNullOrWhiteSpace() )
{
ddlFrom.Help = GetAttributeValue( "FromEmailHelp" );

List<ListItem> items = new List<ListItem>();
if ( CurrentPerson.Email.IsNotNullOrWhiteSpace() )
{
items.Add( new ListItem( CurrentPerson.Email ) );
}
items.Add( new ListItem( GetAttributeValue( "SafeSenderEmail" ) ) );

ddlFrom.DataSource = items;
ddlFrom.DataBind();

Guid? restrictedDomainsGuid = GetAttributeValue( "RestrictedDomains" ).AsGuidOrNull();
if ( restrictedDomainsGuid.HasValue )
{
var restrictedDomains = DefinedTypeCache.Get( restrictedDomainsGuid.Value );
if ( restrictedDomains.DefinedValues.Where( dv => CurrentPerson.Email.EndsWith( dv.Value ) ).Any() )
{
ddlFrom.SelectedValue = GetAttributeValue( "SafeSenderEmail" );
ddlFrom.Enabled = false;
}
}
ltFromEmail.Text = safeSenderEmail;
}
else
{
ddlFrom.Visible = false;
ltFromEmail.Text = "";
}
Comment thread
stphnlee marked this conversation as resolved.
}

Expand All @@ -320,7 +298,7 @@ protected void btnEmailSend_Click( object sender, EventArgs e )

communication.Subject = tbSubject.Text;
communication.FromName = CurrentPerson.FullName;
communication.FromEmail = ddlFrom.SelectedValue;
communication.FromEmail = GetAttributeValue( "SafeSenderEmail" );
communication.ReplyToEmail = CurrentPerson.Email;
communication.Message = tbBody.Text.Replace( "\n", "<br />" );
Comment thread
stphnlee marked this conversation as resolved.

Expand Down