Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ public ConnectorProperties getProperties() {
properties.setUsername(usernameField.getText());
properties.setPassword(new String(passwordField.getPassword()));
properties.setTo(toField.getText());
properties.setCc(ccField.getText());
properties.setBcc(bccField.getText());
properties.setFrom(fromField.getText());
properties.setSubject(subjectField.getText());

Expand Down Expand Up @@ -185,6 +187,8 @@ public void setProperties(ConnectorProperties properties) {
usernameField.setText(props.getUsername());
passwordField.setText(props.getPassword());
toField.setText(props.getTo());
ccField.setText(props.getCc());
bccField.setText(props.getBcc());
fromField.setText(props.getFrom());
subjectField.setText(props.getSubject());

Expand Down Expand Up @@ -257,13 +261,13 @@ public boolean checkProperties(ConnectorProperties properties, boolean highlight
errors.append("\"Send Timeout\" is required\n");
}

if (props.getTo().length() == 0) {
if (StringUtils.isBlank(props.getTo()) && StringUtils.isBlank(props.getCc()) && StringUtils.isBlank(props.getBcc())) {
valid = false;
if (highlight) {
toField.setBackground(UIConstants.INVALID_COLOR);
}

errors.append("\"To\" is required\n");
errors.append("At least one of \"To\", \"CC\", or \"BCC\" is required\n");
}

if (props.getFrom().length() == 0) {
Expand Down Expand Up @@ -695,6 +699,12 @@ public void actionPerformed(ActionEvent evt) {
toLabel = new JLabel("To:");
toField = new MirthTextField();

ccLabel = new JLabel("CC:");
ccField = new MirthTextField();

bccLabel = new JLabel("BCC:");
bccField = new MirthTextField();

fromLabel = new JLabel("From:");
fromField = new MirthTextField();

Expand Down Expand Up @@ -828,6 +838,8 @@ private void initToolTips() {
usernameField.setToolTipText("If the SMTP server requires authentication to send a message, enter the username here.");
passwordField.setToolTipText("If the SMTP server requires authentication to send a message, enter the password here.");
toField.setToolTipText("The name of the mailbox (person, usually) to which the email should be sent.");
ccField.setToolTipText("Addresses to carbon copy the email to.");
bccField.setToolTipText("Addresses to blind carbon copy the email to.");
fromField.setToolTipText("The name that should appear as the \"From address\" in the email.");
subjectField.setToolTipText("The text that should appear as the subject of the email, as seen by the receiver's email client.");
charsetEncodingComboBox.setToolTipText(String.format("<html>Select the character set encoding used by the sender of the message,<br> or Default to assume the default character set encoding for the JVM running %s.</html>", BrandingConstants.PRODUCT_NAME));
Expand Down Expand Up @@ -875,6 +887,10 @@ private void initLayout() {
add(passwordField, "w 125!, sx");
add(toLabel, "newline, right");
add(toField, "w 200!, sx");
add(ccLabel, "newline, right");
add(ccField, "w 200!, sx");
add(bccLabel, "newline, right");
add(bccField, "w 200!, sx");
add(fromLabel, "newline, right");
add(fromField, "w 200!, sx");
add(subjectLabel, "newline, right");
Expand Down Expand Up @@ -1035,6 +1051,10 @@ private void useHeadersVariableFieldsEnabled(boolean useVariable) {
private MirthPasswordField passwordField;
private JLabel toLabel;
private MirthTextField toField;
private JLabel ccLabel;
private MirthTextField ccField;
private JLabel bccLabel;
private MirthTextField bccField;
private JLabel fromLabel;
private MirthTextField fromField;
private JLabel subjectLabel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public ConnectionTestResponse sendTestEmail(String channelId, String channelName
props.put("username", replacer.replaceValues(properties.getUsername(), channelId, channelName));
props.put("password", replacer.replaceValues(properties.getPassword(), channelId, channelName));
props.put("toAddress", replacer.replaceValues(properties.getTo(), channelId, channelName));
props.put("ccAddress", replacer.replaceValues(properties.getCc(), channelId, channelName));
props.put("bccAddress", replacer.replaceValues(properties.getBcc(), channelId, channelName));
props.put("fromAddress", replacer.replaceValues(properties.getFrom(), channelId, channelName));

return configurationController.sendTestEmail(props);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,8 @@ public ConnectionTestResponse sendTestEmail(Properties properties) throws Except
String username = properties.getProperty("username");
String password = properties.getProperty("password");
String to = properties.getProperty("toAddress");
String cc = properties.getProperty("ccAddress");
String bcc = properties.getProperty("bccAddress");
String from = properties.getProperty("fromAddress");

int port = -1;
Expand Down Expand Up @@ -1690,6 +1692,14 @@ public ConnectionTestResponse sendTestEmail(Properties properties) throws Except
email.addTo(toAddress);
}

for (String ccAddress : StringUtils.split(cc, ",")) {
email.addCc(ccAddress);
}

for (String bccAddress : StringUtils.split(bcc, ",")) {
email.addBcc(bccAddress);
}

email.setFrom(from);
email.setMsg(String.format(
"Receipt of this email confirms that mail originating from this %s Server is capable of reaching its intended destination.\n\nSMTP Configuration:\n- Host: %s\n- Port: %d",
Expand Down
Loading