Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4580 change from and reply to addresses in contact email #4600

Conversation

qqmyers
Copy link
Member

@qqmyers qqmyers commented Apr 18, 2018

New Contributors

Welcome! New contributors should at least glance at CONTRIBUTING.md, especially the section on pull requests where we encourage you to reach out to other developers before you start coding. Also, please note that we measure code coverage and prefer you write unit tests. Pull requests can still be reviewed without tests or completion of the checklist outlined below. Thanks!

Related Issues

Pull Request Checklist

qqmyers added 2 commits April 18, 2018 12:40
and set reply-to to the requested 'from' address
Changing from address personal name to reflect reply address
@coveralls
Copy link

coveralls commented Apr 18, 2018

Coverage Status

Coverage decreased (-0.002%) to 13.114% when pulling d25e354 on QualitativeDataRepository:4580-change-from-and-reply-to-addresses-in-contact-email into b7a2131 on IQSS:develop.

@mheppler
Copy link
Contributor

Added issue title and number to comment from @qqmyers above in order to link the PR and issue.

@pdurbin pdurbin self-assigned this Apr 18, 2018
Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might need to think about this pull request some more before explicitly approving it, but I'm at least leaving some comments. I'm glad to read in #4580 that this is a good fix for preventing emails from being blocked on Amazon SES. In that issue @qqmyers observed that there are many "sendMail" methods and we might want to reduce this number if we can.

@@ -89,7 +90,10 @@ public void sendMail(String host, String from, String to, String subject, String
String[] recipientStrings = to.split(",");
InternetAddress[] recipients = new InternetAddress[recipientStrings.length];
try {
msg.setFrom(new InternetAddress(from, charset));
InternetAddress fromAddress=getSystemAddress();
fromAddress.setPersonal(fromAddress.getPersonal() + "on behalf of " + reply, charset);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should "on behalf of" be put into Bundle.properties so it can be translated into various languages?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See BundleUtil.getStringFromBundle examples in this file (lower down).

//Always send from system address to avoid email being blocked
InternetAddress fromAddress=getSystemAddress();
try {
fromAddress.setPersonal(fromAddress.getPersonal() + "on behalf of " + reply, charset);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a space before the "on" here and see above about internationalization.

fromAddress.setPersonal(fromAddress.getPersonal() + "on behalf of " + reply, charset);
} catch (UnsupportedEncodingException ex) {
logger.severe(ex.getMessage());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're catching UnsupportedEncodingException here and logging the exception, which is good, but should we return in this catch rather than marching forward?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was mostly following the pattern in the other methods, but this exception would be non-fatal (and presumably not likely since charset is set to 'UTF-8' on line 73). The message could go out without the 'on behalf of ' addition, which would probably be better (?) than failing to send anything.

msg.setFrom(getSystemAddress());
messageText = "From: " + from + "\n\n" + messageText;
//Otherwise include the invalid 'from' address in the message
messageText = "From: " + reply + "\n\n" + messageText;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mheppler you want this "From:" line to go away, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pdurbin Maybe someday, but please it as is for this issue. I will open a new issue to track if there is a problem there. Thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mheppler ok, I see you opened #4601. Thanks.

@@ -79,7 +80,7 @@
public MailServiceBean() {
}

public void sendMail(String host, String from, String to, String subject, String messageText) {
public void sendMail(String host, String reply, String to, String subject, String messageText) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see any use of this method in the current source...

@pdurbin pdurbin removed their assignment Apr 19, 2018
@qqmyers
Copy link
Member Author

qqmyers commented Apr 19, 2018

Changed to use a message from Bundle.properties and merged with the develop branch...

@kcondon kcondon merged commit 747b83c into IQSS:develop Apr 19, 2018
@qqmyers qqmyers deleted the 4580-change-from-and-reply-to-addresses-in-contact-email branch April 19, 2018 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants