Skip to content
Closed
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
7 changes: 4 additions & 3 deletions src/Service/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public function sendCommentReportedFeedbackEmail(Member $member, $parameters): b
{
$parameters['sender'] = $member;
$parameters['receiver'] = $member;
$parameters['reporterEmail'] = $member->getEmail();
$feedbackCategoryRepository = $this->entityManager->getRepository(FeedbackCategory::class);
$feedbackCategory = $feedbackCategoryRepository->findOneBy(['name' => 'Comment_issue']);

Expand All @@ -101,7 +102,6 @@ public function sendCommentReportedFeedbackEmail(Member $member, $parameters): b
new Address($feedbackCategory->getEmailToNotify(), 'Comment Issue'),
'comment.feedback',
$parameters,
$member->getEmail(),
);
}

Expand Down Expand Up @@ -149,7 +149,9 @@ public function sendNotificationEmail(Address $sender, Member $receiver, $parame

/**
* Sends contact/feedback form submissions to the helpdesk queue.
* From: is always noreply@bewelcome.org to pass DMARC; the reporter's address goes in Reply-To.
* From: noreply@bewelcome.org (passes DMARC). No Reply-To — freemail in Reply-To triggers
* SPOOF_REPLYTO+FREEMAIL_REPLYTO_NEQ_FROM in rspamd, scoring ~8 pts and routing to Junk.
* The reporter's address is already rendered in the email body by feedback.html.twig.
*/
public function sendFeedbackEmail($sender, Address $receiver, $parameters): bool
{
Expand All @@ -161,7 +163,6 @@ public function sendFeedbackEmail($sender, Address $receiver, $parameters): bool
$receiver,
'feedback',
$parameters,
\is_string($sender) ? $sender : null,
);
}

Expand Down
2 changes: 1 addition & 1 deletion templates/emails/comment.feedback.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'emails/email.html.twig' %}

{% block content%}
<p>The user {{ comment.toMember.username }} provided feedback for a comment:</p>
<p>The user {{ comment.toMember.username }} ({{ reporterEmail }}) provided feedback for a comment:</p>
<p>{{ feedback }}</p>
<p>Please check the comment here: <a href="{{ url('admin_comment', { to_member: comment.toMember.username, from_member: comment.fromMember.username}) }}">Comment from {{ comment.fromMember.username }}</a></p>
{% endblock content %}
8 changes: 2 additions & 6 deletions tests/Service/MailerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ public function testSendFeedbackEmailUsesNoreplyAsFrom(): void
$this->assertCount(1, $from);
$this->assertSame('noreply@bewelcome.org', $from[0]->getAddress(), 'From must be noreply to pass DMARC');

$replyTo = $captured->getReplyTo();
$this->assertCount(1, $replyTo);
$this->assertSame('reporter@yahoo.fr', $replyTo[0]->getAddress(), 'Reply-To must be the reporter so staff can reply');
$this->assertEmpty($captured->getReplyTo(), 'No Reply-To: freemail Reply-To triggers SPOOF_REPLYTO in rspamd and routes to Junk');
}

public function testSendFeedbackEmailNullFallbackUsesNoreplyWithNoReplyTo(): void
Expand Down Expand Up @@ -155,8 +153,6 @@ public function testSendCommentReportedFeedbackEmailUsesNoreplyAsFrom(): void
$this->assertCount(1, $from);
$this->assertSame('noreply@bewelcome.org', $from[0]->getAddress(), 'From must be noreply to pass DMARC');

$replyTo = $captured->getReplyTo();
$this->assertCount(1, $replyTo);
$this->assertSame('member@gmail.com', $replyTo[0]->getAddress(), 'Reply-To must be the member so staff can reply');
$this->assertEmpty($captured->getReplyTo(), 'No Reply-To: freemail Reply-To triggers SPOOF_REPLYTO in rspamd and routes to Junk');
}
}
Loading