Skip to content

Commit

Permalink
updated logic for handling domains in send email actions
Browse files Browse the repository at this point in the history
  • Loading branch information
hardik-crest committed May 10, 2024
1 parent c6a6da5 commit 961646d
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions smtp_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,6 @@ def _is_html(self, body):

def _send_email(self, param, action_result):

action_id = self.get_action_identifier()

# username = self.get_config()[phantom.APP_JSON_USERNAME]
config = self.get_config()

Expand All @@ -826,12 +824,10 @@ def _send_email(self, param, action_result):
email_from = param.get(SMTP_JSON_FROM, sender_address)

# validate sender email if inputted as a parameter
if param.get(SMTP_JSON_FROM) is not None:
# validate sender email when action is not test connectivity
if action_id != self.ACTION_ID_TEST_CONNECTIVITY:
ret_val = self._validate_sender_email(action_result, email_from)
if phantom.is_fail(ret_val):
return action_result.get_status()
if email_from:
ret_val = self._validate_sender_email(action_result, email_from)
if phantom.is_fail(ret_val):
return action_result.get_status()

encoding = config.get(SMTP_ENCODING, False)
smtputf8 = config.get(SMTP_ALLOW_SMTPUTF8, False)
Expand Down Expand Up @@ -1055,7 +1051,7 @@ def _handle_send_htmlemail(self, param): # noqa: C901
email_from = param.get(SMTP_JSON_FROM, sender_address)

# validate sender email if inputted as a parameter
if param.get(SMTP_JSON_FROM) is not None:
if email_from:
ret_val = self._validate_sender_email(action_result, email_from)
if phantom.is_fail(ret_val):
return action_result.get_status()
Expand Down

0 comments on commit 961646d

Please sign in to comment.