mirror of
https://github.com/google/nomulus.git
synced 2025-06-24 05:11:10 +02:00
Rename Spec11 reply-to email and also use it as sending address (#201)
* Rename Spec11 reply-to email and also use it as sending address
This commit is contained in:
parent
32677ef056
commit
fc8aa9569f
5 changed files with 33 additions and 37 deletions
|
@ -894,9 +894,9 @@ public final class RegistryConfig {
|
||||||
* @see google.registry.reporting.spec11.Spec11EmailUtils
|
* @see google.registry.reporting.spec11.Spec11EmailUtils
|
||||||
*/
|
*/
|
||||||
@Provides
|
@Provides
|
||||||
@Config("spec11ReplyToEmailAddress")
|
@Config("spec11OutgoingEmailAddress")
|
||||||
public static InternetAddress provideSpec11ReplyToEmailAddress(RegistryConfigSettings config) {
|
public static InternetAddress provideSpec11OutgoingEmailAddress(RegistryConfigSettings config) {
|
||||||
return parseEmailAddress(config.misc.spec11ReplyToEmailAddress);
|
return parseEmailAddress(config.misc.spec11OutgoingEmailAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -173,7 +173,7 @@ public class RegistryConfigSettings {
|
||||||
public static class Misc {
|
public static class Misc {
|
||||||
public String sheetExportId;
|
public String sheetExportId;
|
||||||
public String alertRecipientEmailAddress;
|
public String alertRecipientEmailAddress;
|
||||||
public String spec11ReplyToEmailAddress;
|
public String spec11OutgoingEmailAddress;
|
||||||
public int asyncDeleteDelaySeconds;
|
public int asyncDeleteDelaySeconds;
|
||||||
public int transientFailureRetries;
|
public int transientFailureRetries;
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,9 +357,9 @@ misc:
|
||||||
# Address we send alert summary emails to.
|
# Address we send alert summary emails to.
|
||||||
alertRecipientEmailAddress: email@example.com
|
alertRecipientEmailAddress: email@example.com
|
||||||
|
|
||||||
# Address to which the Spec 11 emails to registrars should be replied. This needs
|
# Address from which Spec 11 emails to registrars are sent. This needs
|
||||||
# to be a deliverable email address in case the registrars want to contact us.
|
# to be a deliverable email address to handle replies from registrars as well.
|
||||||
spec11ReplyToEmailAddress: reply-to@example.com
|
spec11OutgoingEmailAddress: abuse@example.com
|
||||||
|
|
||||||
# How long to delay processing of asynchronous deletions. This should always
|
# How long to delay processing of asynchronous deletions. This should always
|
||||||
# be longer than eppResourceCachingSeconds, to prevent deleted contacts or
|
# be longer than eppResourceCachingSeconds, to prevent deleted contacts or
|
||||||
|
|
|
@ -59,22 +59,19 @@ public class Spec11EmailUtils {
|
||||||
private final SendEmailService emailService;
|
private final SendEmailService emailService;
|
||||||
private final InternetAddress outgoingEmailAddress;
|
private final InternetAddress outgoingEmailAddress;
|
||||||
private final InternetAddress alertRecipientAddress;
|
private final InternetAddress alertRecipientAddress;
|
||||||
private final InternetAddress spec11ReplyToAddress;
|
|
||||||
private final ImmutableList<String> spec11WebResources;
|
private final ImmutableList<String> spec11WebResources;
|
||||||
private final String registryName;
|
private final String registryName;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
Spec11EmailUtils(
|
Spec11EmailUtils(
|
||||||
SendEmailService emailService,
|
SendEmailService emailService,
|
||||||
@Config("gSuiteOutgoingEmailAddress") InternetAddress outgoingEmailAddress,
|
|
||||||
@Config("alertRecipientEmailAddress") InternetAddress alertRecipientAddress,
|
@Config("alertRecipientEmailAddress") InternetAddress alertRecipientAddress,
|
||||||
@Config("spec11ReplyToEmailAddress") InternetAddress spec11ReplyToAddress,
|
@Config("spec11OutgoingEmailAddress") InternetAddress spec11OutgoingEmailAddress,
|
||||||
@Config("spec11WebResources") ImmutableList<String> spec11WebResources,
|
@Config("spec11WebResources") ImmutableList<String> spec11WebResources,
|
||||||
@Config("registryName") String registryName) {
|
@Config("registryName") String registryName) {
|
||||||
this.emailService = emailService;
|
this.emailService = emailService;
|
||||||
this.outgoingEmailAddress = outgoingEmailAddress;
|
this.outgoingEmailAddress = spec11OutgoingEmailAddress;
|
||||||
this.alertRecipientAddress = alertRecipientAddress;
|
this.alertRecipientAddress = alertRecipientAddress;
|
||||||
this.spec11ReplyToAddress = spec11ReplyToAddress;
|
|
||||||
this.spec11WebResources = spec11WebResources;
|
this.spec11WebResources = spec11WebResources;
|
||||||
this.registryName = registryName;
|
this.registryName = registryName;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +146,7 @@ public class Spec11EmailUtils {
|
||||||
.setContentType(MediaType.HTML_UTF_8)
|
.setContentType(MediaType.HTML_UTF_8)
|
||||||
.setFrom(outgoingEmailAddress)
|
.setFrom(outgoingEmailAddress)
|
||||||
.addRecipient(getEmailAddressForRegistrar(registrarThreatMatches.clientId()))
|
.addRecipient(getEmailAddressForRegistrar(registrarThreatMatches.clientId()))
|
||||||
.setBcc(spec11ReplyToAddress)
|
.setBcc(outgoingEmailAddress)
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +169,7 @@ public class Spec11EmailUtils {
|
||||||
ImmutableMap.of(
|
ImmutableMap.of(
|
||||||
"date", date.toString(),
|
"date", date.toString(),
|
||||||
"registry", registryName,
|
"registry", registryName,
|
||||||
"replyToEmail", spec11ReplyToAddress.getAddress(),
|
"replyToEmail", outgoingEmailAddress.getAddress(),
|
||||||
"threats", threatMatchMap,
|
"threats", threatMatchMap,
|
||||||
"resources", spec11WebResources);
|
"resources", spec11WebResources);
|
||||||
renderer.setData(data);
|
renderer.setData(data);
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class Spec11EmailUtilsTest {
|
||||||
+ "update your abuse contact using your registrar portal account.</p>"
|
+ "update your abuse contact using your registrar portal account.</p>"
|
||||||
+ ""
|
+ ""
|
||||||
+ "<p>If you have any questions regarding this notice, please contact "
|
+ "<p>If you have any questions regarding this notice, please contact "
|
||||||
+ "my-reply-to@test.com.</p>";
|
+ "abuse@test.com.</p>";
|
||||||
private static final String MONTHLY_EMAIL_FORMAT =
|
private static final String MONTHLY_EMAIL_FORMAT =
|
||||||
"Dear registrar partner,"
|
"Dear registrar partner,"
|
||||||
+ ""
|
+ ""
|
||||||
|
@ -117,7 +117,7 @@ public class Spec11EmailUtilsTest {
|
||||||
+ "our monthly reporting.</p>"
|
+ "our monthly reporting.</p>"
|
||||||
+ ""
|
+ ""
|
||||||
+ "<p>If you have any questions regarding this notice, please contact "
|
+ "<p>If you have any questions regarding this notice, please contact "
|
||||||
+ "my-reply-to@test.com.</p>";
|
+ "abuse@test.com.</p>";
|
||||||
|
|
||||||
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
|
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
|
||||||
|
|
||||||
|
@ -139,9 +139,8 @@ public class Spec11EmailUtilsTest {
|
||||||
emailUtils =
|
emailUtils =
|
||||||
new Spec11EmailUtils(
|
new Spec11EmailUtils(
|
||||||
emailService,
|
emailService,
|
||||||
new InternetAddress("my-sender@test.com"),
|
|
||||||
new InternetAddress("my-receiver@test.com"),
|
new InternetAddress("my-receiver@test.com"),
|
||||||
new InternetAddress("my-reply-to@test.com"),
|
new InternetAddress("abuse@test.com"),
|
||||||
FAKE_RESOURCES,
|
FAKE_RESOURCES,
|
||||||
"Super Cool Registry");
|
"Super Cool Registry");
|
||||||
|
|
||||||
|
@ -164,17 +163,17 @@ public class Spec11EmailUtilsTest {
|
||||||
List<EmailMessage> capturedContents = contentCaptor.getAllValues();
|
List<EmailMessage> capturedContents = contentCaptor.getAllValues();
|
||||||
validateMessage(
|
validateMessage(
|
||||||
capturedContents.get(0),
|
capturedContents.get(0),
|
||||||
"my-sender@test.com",
|
"abuse@test.com",
|
||||||
"the.registrar@example.com",
|
"the.registrar@example.com",
|
||||||
Optional.of("my-reply-to@test.com"),
|
Optional.of("abuse@test.com"),
|
||||||
"Super Cool Registry Monthly Threat Detector [2018-07-15]",
|
"Super Cool Registry Monthly Threat Detector [2018-07-15]",
|
||||||
String.format(MONTHLY_EMAIL_FORMAT, "<tr><td>a.com</td><td>MALWARE</td></tr>"),
|
String.format(MONTHLY_EMAIL_FORMAT, "<tr><td>a.com</td><td>MALWARE</td></tr>"),
|
||||||
Optional.of(MediaType.HTML_UTF_8));
|
Optional.of(MediaType.HTML_UTF_8));
|
||||||
validateMessage(
|
validateMessage(
|
||||||
capturedContents.get(1),
|
capturedContents.get(1),
|
||||||
"my-sender@test.com",
|
"abuse@test.com",
|
||||||
"new.registrar@example.com",
|
"new.registrar@example.com",
|
||||||
Optional.of("my-reply-to@test.com"),
|
Optional.of("abuse@test.com"),
|
||||||
"Super Cool Registry Monthly Threat Detector [2018-07-15]",
|
"Super Cool Registry Monthly Threat Detector [2018-07-15]",
|
||||||
String.format(
|
String.format(
|
||||||
MONTHLY_EMAIL_FORMAT,
|
MONTHLY_EMAIL_FORMAT,
|
||||||
|
@ -182,7 +181,7 @@ public class Spec11EmailUtilsTest {
|
||||||
Optional.of(MediaType.HTML_UTF_8));
|
Optional.of(MediaType.HTML_UTF_8));
|
||||||
validateMessage(
|
validateMessage(
|
||||||
capturedContents.get(2),
|
capturedContents.get(2),
|
||||||
"my-sender@test.com",
|
"abuse@test.com",
|
||||||
"my-receiver@test.com",
|
"my-receiver@test.com",
|
||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
"Spec11 Pipeline Success 2018-07-15",
|
"Spec11 Pipeline Success 2018-07-15",
|
||||||
|
@ -202,17 +201,17 @@ public class Spec11EmailUtilsTest {
|
||||||
List<EmailMessage> capturedMessages = contentCaptor.getAllValues();
|
List<EmailMessage> capturedMessages = contentCaptor.getAllValues();
|
||||||
validateMessage(
|
validateMessage(
|
||||||
capturedMessages.get(0),
|
capturedMessages.get(0),
|
||||||
"my-sender@test.com",
|
"abuse@test.com",
|
||||||
"the.registrar@example.com",
|
"the.registrar@example.com",
|
||||||
Optional.of("my-reply-to@test.com"),
|
Optional.of("abuse@test.com"),
|
||||||
"Super Cool Registry Daily Threat Detector [2018-07-15]",
|
"Super Cool Registry Daily Threat Detector [2018-07-15]",
|
||||||
String.format(DAILY_EMAIL_FORMAT, "<tr><td>a.com</td><td>MALWARE</td></tr>"),
|
String.format(DAILY_EMAIL_FORMAT, "<tr><td>a.com</td><td>MALWARE</td></tr>"),
|
||||||
Optional.of(MediaType.HTML_UTF_8));
|
Optional.of(MediaType.HTML_UTF_8));
|
||||||
validateMessage(
|
validateMessage(
|
||||||
capturedMessages.get(1),
|
capturedMessages.get(1),
|
||||||
"my-sender@test.com",
|
"abuse@test.com",
|
||||||
"new.registrar@example.com",
|
"new.registrar@example.com",
|
||||||
Optional.of("my-reply-to@test.com"),
|
Optional.of("abuse@test.com"),
|
||||||
"Super Cool Registry Daily Threat Detector [2018-07-15]",
|
"Super Cool Registry Daily Threat Detector [2018-07-15]",
|
||||||
String.format(
|
String.format(
|
||||||
DAILY_EMAIL_FORMAT,
|
DAILY_EMAIL_FORMAT,
|
||||||
|
@ -220,7 +219,7 @@ public class Spec11EmailUtilsTest {
|
||||||
Optional.of(MediaType.HTML_UTF_8));
|
Optional.of(MediaType.HTML_UTF_8));
|
||||||
validateMessage(
|
validateMessage(
|
||||||
capturedMessages.get(2),
|
capturedMessages.get(2),
|
||||||
"my-sender@test.com",
|
"abuse@test.com",
|
||||||
"my-receiver@test.com",
|
"my-receiver@test.com",
|
||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
"Spec11 Pipeline Success 2018-07-15",
|
"Spec11 Pipeline Success 2018-07-15",
|
||||||
|
@ -247,15 +246,15 @@ public class Spec11EmailUtilsTest {
|
||||||
List<EmailMessage> capturedContents = contentCaptor.getAllValues();
|
List<EmailMessage> capturedContents = contentCaptor.getAllValues();
|
||||||
validateMessage(
|
validateMessage(
|
||||||
capturedContents.get(0),
|
capturedContents.get(0),
|
||||||
"my-sender@test.com",
|
"abuse@test.com",
|
||||||
"new.registrar@example.com",
|
"new.registrar@example.com",
|
||||||
Optional.of("my-reply-to@test.com"),
|
Optional.of("abuse@test.com"),
|
||||||
"Super Cool Registry Monthly Threat Detector [2018-07-15]",
|
"Super Cool Registry Monthly Threat Detector [2018-07-15]",
|
||||||
String.format(MONTHLY_EMAIL_FORMAT, "<tr><td>c.com</td><td>MALWARE</td></tr>"),
|
String.format(MONTHLY_EMAIL_FORMAT, "<tr><td>c.com</td><td>MALWARE</td></tr>"),
|
||||||
Optional.of(MediaType.HTML_UTF_8));
|
Optional.of(MediaType.HTML_UTF_8));
|
||||||
validateMessage(
|
validateMessage(
|
||||||
capturedContents.get(1),
|
capturedContents.get(1),
|
||||||
"my-sender@test.com",
|
"abuse@test.com",
|
||||||
"my-receiver@test.com",
|
"my-receiver@test.com",
|
||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
"Spec11 Pipeline Success 2018-07-15",
|
"Spec11 Pipeline Success 2018-07-15",
|
||||||
|
@ -292,17 +291,17 @@ public class Spec11EmailUtilsTest {
|
||||||
List<EmailMessage> capturedMessages = contentCaptor.getAllValues();
|
List<EmailMessage> capturedMessages = contentCaptor.getAllValues();
|
||||||
validateMessage(
|
validateMessage(
|
||||||
capturedMessages.get(0),
|
capturedMessages.get(0),
|
||||||
"my-sender@test.com",
|
"abuse@test.com",
|
||||||
"the.registrar@example.com",
|
"the.registrar@example.com",
|
||||||
Optional.of("my-reply-to@test.com"),
|
Optional.of("abuse@test.com"),
|
||||||
"Super Cool Registry Monthly Threat Detector [2018-07-15]",
|
"Super Cool Registry Monthly Threat Detector [2018-07-15]",
|
||||||
String.format(MONTHLY_EMAIL_FORMAT, "<tr><td>a.com</td><td>MALWARE</td></tr>"),
|
String.format(MONTHLY_EMAIL_FORMAT, "<tr><td>a.com</td><td>MALWARE</td></tr>"),
|
||||||
Optional.of(MediaType.HTML_UTF_8));
|
Optional.of(MediaType.HTML_UTF_8));
|
||||||
validateMessage(
|
validateMessage(
|
||||||
capturedMessages.get(1),
|
capturedMessages.get(1),
|
||||||
"my-sender@test.com",
|
"abuse@test.com",
|
||||||
"new.registrar@example.com",
|
"new.registrar@example.com",
|
||||||
Optional.of("my-reply-to@test.com"),
|
Optional.of("abuse@test.com"),
|
||||||
"Super Cool Registry Monthly Threat Detector [2018-07-15]",
|
"Super Cool Registry Monthly Threat Detector [2018-07-15]",
|
||||||
String.format(
|
String.format(
|
||||||
MONTHLY_EMAIL_FORMAT,
|
MONTHLY_EMAIL_FORMAT,
|
||||||
|
@ -310,7 +309,7 @@ public class Spec11EmailUtilsTest {
|
||||||
Optional.of(MediaType.HTML_UTF_8));
|
Optional.of(MediaType.HTML_UTF_8));
|
||||||
validateMessage(
|
validateMessage(
|
||||||
capturedMessages.get(2),
|
capturedMessages.get(2),
|
||||||
"my-sender@test.com",
|
"abuse@test.com",
|
||||||
"my-receiver@test.com",
|
"my-receiver@test.com",
|
||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
"Spec11 Emailing Failure 2018-07-15",
|
"Spec11 Emailing Failure 2018-07-15",
|
||||||
|
@ -324,7 +323,7 @@ public class Spec11EmailUtilsTest {
|
||||||
verify(emailService).sendEmail(contentCaptor.capture());
|
verify(emailService).sendEmail(contentCaptor.capture());
|
||||||
validateMessage(
|
validateMessage(
|
||||||
contentCaptor.getValue(),
|
contentCaptor.getValue(),
|
||||||
"my-sender@test.com",
|
"abuse@test.com",
|
||||||
"my-receiver@test.com",
|
"my-receiver@test.com",
|
||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
"Spec11 Pipeline Alert: 2018-07",
|
"Spec11 Pipeline Alert: 2018-07",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue