Skip to content

Commit

Permalink
- After some discussion, we've decided that this particular Send() me…
Browse files Browse the repository at this point in the history
…thod of the SMTPComponent should also check the from address and use the GlobalAttribute setting like it did before the cc47358 commit. (re fixes #798)
  • Loading branch information
nairdo committed Feb 13, 2015
1 parent db19fba commit 37a10dc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
17 changes: 13 additions & 4 deletions Rock/Communication/SMTPComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,21 @@ public override void Send( Rock.Model.Communication communication )

var globalAttributes = Rock.Web.Cache.GlobalAttributesCache.Read();

// From
// From - if none is set, use the one in the Organization's GlobalAttributes.
string fromAddress = communication.GetMediumDataValue( "FromAddress" );
if ( string.IsNullOrWhiteSpace( fromAddress ) )
{
fromAddress = globalAttributes.GetValue( "OrganizationEmail" );
}

string fromName = communication.GetMediumDataValue( "FromName" );
if ( string.IsNullOrWhiteSpace( fromName ) )
{
fromName = globalAttributes.GetValue( "OrganizationName" );
}

MailMessage message = new MailMessage();
message.From = new MailAddress(
fromAddress,
communication.GetMediumDataValue( "FromName" ) );
message.From = new MailAddress( fromAddress, fromName );

// Reply To
string replyTo = communication.GetMediumDataValue( "ReplyTo" );
Expand Down
4 changes: 0 additions & 4 deletions RockWeb/Blocks/Crm/PhotoSendRequest.ascx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,6 @@ private void GetTemplateData()
if ( template != null )
{
var mediumData = template.MediumData;
if ( !mediumData.ContainsKey( "FromAddress" ) )
{
throw new Exception( string.Format( "The '{0}' communication template is missing a From address.", template.Name ) );
}

if ( !mediumData.ContainsKey( "Subject" ) )
{
Expand Down

0 comments on commit 37a10dc

Please sign in to comment.