Email newsletter

{{#if this.post.email.isSuccess}} {{!-- Mail has already been sent --}}
{{svg-jar "send-email" class="w7 h7 stroke-darkgrey"}}

Post was sent by email to

{{pluralize this.post.email.emailCount "member"}}

Subject: {{this.post.email.subject}}
Sent on: {{gh-format-post-time this.post.email.createdAtUTC}}

{{else if (or this.retryEmail.isRunning this.post.email.isFailure)}} {{!-- Mail failed to send --}}

Email failed to send when publishing this post. Please check your Mailgun configuration under Labs → Members if the error persists.

{{svg-jar "warning"}} {{this.post.email.error}}


{{svg-jar "send-email" class="w7 h7 stroke-darkgrey"}}

Post failed to send to

{{pluralize this.post.email.emailCount "member"}}

Subject: {{this.post.email.subject}}
Tried: {{gh-format-post-time this.post.email.createdAtUTC}}

{{else}} {{!-- Mail not sent yet --}} {{#if this.mailgunError}}

{{svg-jar "info" class="w5 h5 fill-yellow nl1"}} You need to configure Mailgun in {{#link-to "settings.labs" data-test-nav="labs"}}Labs → Members settings{{/link-to}} to enable email newsletters.

{{/if}}
{{#gh-form-group errors=this.post.errors hasValidated=this.post.hasValidated property="emailSubject"}} {{gh-text-input class="post-setting-email-subject" id="email-subject" name="post-setting-email-subject" placeholder=(truncate this.emailSubject 40) value=(readonly this.emailSubjectScratch) input=(action (mut this.emailSubjectScratch) value="target.value") focus-out=(action "setEmailSubject" this.emailSubjectScratch) stopEnterKeyDownPropagation=true disabled=this.mailgunError data-test-field="email-subject"}} {{gh-error-message errors=this.post.errors property="emailSubject" data-test-error="email-subject"}} {{/gh-form-group}}
{{gh-text-input class="post-setting-email-test" id="email-test" name="post-setting-email-test" placeholder="noreply@example.com" value=this.testEmailAddress stopEnterKeyDownPropagation=true disabled=this.mailgunError data-test-field="email-test"}} {{#if this.sendTestEmailError}}

{{this.sendTestEmailError}}

{{/if}} {{gh-task-button "Send test email" task=this.sendTestEmail successText="Email sent" runningText="Sending..." class="gh-btn w-100 mt2 gh-btn-icon" disabled=this.mailgunError data-test-send-test-mail=true }}
{{/if}}