#865 #1459 Added the Sender From field for email notifcations. We can now have "Friendly Names" for email notifications.

Also fixed the copy and paste error with the Settings dropdowns. Slack menu item is now labelled Slack instead of Discord
This commit is contained in:
Jamie.Rees 2017-08-08 12:50:05 +01:00
parent d5477adc6b
commit 03add0ffc8
7 changed files with 22 additions and 12 deletions

View file

@ -29,7 +29,7 @@ namespace Ombi.Notifications
Body = body.ToMessageBody(), Body = body.ToMessageBody(),
Subject = model.Subject Subject = model.Subject
}; };
message.From.Add(new MailboxAddress(settings.Sender, settings.Sender)); message.From.Add(new MailboxAddress(settings.SenderAddress, settings.SenderAddress));
message.To.Add(new MailboxAddress(model.To, model.To)); message.To.Add(new MailboxAddress(model.To, model.To));
using (var client = new SmtpClient()) using (var client = new SmtpClient())
@ -71,7 +71,8 @@ namespace Ombi.Notifications
Body = body.ToMessageBody(), Body = body.ToMessageBody(),
Subject = model.Subject Subject = model.Subject
}; };
message.From.Add(new MailboxAddress(settings.Sender, settings.Sender));
message.From.Add(new MailboxAddress(string.IsNullOrEmpty(settings.SenderName) ? settings.SenderAddress : settings.SenderName, settings.SenderAddress));
message.To.Add(new MailboxAddress(model.To, model.To)); message.To.Add(new MailboxAddress(model.To, model.To));
using (var client = new SmtpClient()) using (var client = new SmtpClient())

View file

@ -6,7 +6,8 @@
public string Host { get; set; } public string Host { get; set; }
public string Password { get; set; } public string Password { get; set; }
public int Port { get; set; } public int Port { get; set; }
public string Sender { get; set; } public string SenderName { get; set; }
public string SenderAddress { get; set; }
public string Username { get; set; } public string Username { get; set; }
public bool Authentication { get; set; } public bool Authentication { get; set; }
public string AdminEmail { get; set; } public string AdminEmail { get; set; }

View file

@ -10,7 +10,8 @@ export interface IEmailNotificationSettings extends INotificationSettings {
host: string, host: string,
password: string, password: string,
port: number, port: number,
sender: string, senderAddress: string,
senderName:string,
username: string, username: string,
authentication: boolean, authentication: boolean,
adminEmail: string, adminEmail: string,

View file

@ -21,8 +21,8 @@
<div *ngIf="emailForm.invalid && emailForm.dirty" class="alert alert-danger"> <div *ngIf="emailForm.invalid && emailForm.dirty" class="alert alert-danger">
<div *ngIf="emailForm.get('host').hasError('required')">Host is required</div> <div *ngIf="emailForm.get('host').hasError('required')">Host is required</div>
<div *ngIf="emailForm.get('port').hasError('required')">The Port is required</div> <div *ngIf="emailForm.get('port').hasError('required')">The Port is required</div>
<div *ngIf="emailForm.get('sender').hasError('required')">The Email Sender is required</div> <div *ngIf="emailForm.get('senderAddress').hasError('required')">The Email Sender Address is required</div>
<div *ngIf="emailForm.get('sender').hasError('incorrectMailFormat')">The Email Sender needs to be a valid email address</div> <div *ngIf="emailForm.get('senderAddress').hasError('incorrectMailFormat')">The Email Sender Address needs to be a valid email address</div>
<div *ngIf="emailForm.get('adminEmail').hasError('required')">The Email Sender is required</div> <div *ngIf="emailForm.get('adminEmail').hasError('required')">The Email Sender is required</div>
<div *ngIf="emailForm.get('adminEmail').hasError('email')">The Admin Email needs to be a valid email address</div> <div *ngIf="emailForm.get('adminEmail').hasError('email')">The Admin Email needs to be a valid email address</div>
<div *ngIf="emailForm.get('username').hasError('required')">The Username is required</div> <div *ngIf="emailForm.get('username').hasError('required')">The Username is required</div>
@ -44,10 +44,16 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="sender" class="control-label">Email Sender</label> <label style="padding-left: 0" for="senderAddress" class="control-label col-md-12">Email Sender</label>
<div> <div style="padding-left: 0" class="col-md-6">
<input type="text" class="form-control form-control-custom " id="sender" name="sender" formControlName="sender" tooltipPosition="top" pTooltip="The email address that the emails will be sent from"> <input type="text" class="form-control form-control-custom " id="senderAddress" name="senderAddress" formControlName="senderAddress" tooltipPosition="top" placeholder="Sender Address" pTooltip="The email address that the emails will be sent from">
</div> </div>
<div style="padding-left: 0" class="col-md-6">
<input type="text" class="form-control form-control-custom " id="senderName" name="senderName" formControlName="senderName" tooltipPosition="top" placeholder="Sender Name" pTooltip="The 'Friendly' name that will appear in the 'FROM:' part of the email">
</div>
<br/>
<br/>
<br/>
</div> </div>
<div class="form-group"> <div class="form-group">

View file

@ -32,7 +32,8 @@ export class EmailNotificationComponent implements OnInit {
host: [x.host, [Validators.required]], host: [x.host, [Validators.required]],
password: [x.password], password: [x.password],
port: [x.port, [Validators.required]], port: [x.port, [Validators.required]],
sender: [x.sender, [Validators.required, Validators.email]], senderAddress: [x.senderAddress, [Validators.required, Validators.email]],
senderName: [x.senderName],
username: [x.username], username: [x.username],
adminEmail: [x.adminEmail, [Validators.required, Validators.email]], adminEmail: [x.adminEmail, [Validators.required, Validators.email]],
}); });

View file

@ -1,4 +1,4 @@
<i class="fa fa-info-circle" tooltipPosition="top" [escape]="false" pTooltip="{{helpText}}"></i> <i class="fa fa-info-circle" tooltipPosition="left" [escape]="false" pTooltip="{{helpText}}"></i>
<ngb-accordion [closeOthers]="true" activeIds="0-header"> <ngb-accordion [closeOthers]="true" activeIds="0-header">

View file

@ -45,7 +45,7 @@
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Email']">Email</a></li> <li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Email']">Email</a></li>
<!--<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Newsletter']">Newsletter</a></li>--> <!--<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Newsletter']">Newsletter</a></li>-->
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Discord']">Discord</a></li> <li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Discord']">Discord</a></li>
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Slack']">Discord</a></li> <li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Slack']">Slack</a></li>
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Pushbullet']">Pushbullet</a></li> <li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Pushbullet']">Pushbullet</a></li>
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Pushover']">Pushover</a></li> <li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Pushover']">Pushover</a></li>
</ul> </ul>