Skip to content
Merged
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
15 changes: 10 additions & 5 deletions rosetta-test-py/sendmail-python-emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,16 @@ def sendmail_connected(env, backend):
# Send Message
#

@sendmail_suite.placeholder("sendmail-send-message-with-options")
def sendmail_send_message(env, sender:SMTPBackend, message, sender_address, recipient_addresses, message_options, recipients_options):
@sendmail_suite.placeholder("sendmail-send-message-full")
def sendmail_send_message(env, sender:SMTPBackend, message, sender_address, recipient_addresses, cc_addresses, bcc_addresses, custom_headers, message_options, recipients_options):
try:
message = emails.Message(text=message,
subject="Test",
mail_to=recipient_addresses,
mail_from=sender_address)
mail_from=sender_address,
cc=cc_addresses,
bcc=bcc_addresses,
headers=custom_headers,)
return [message.send(smtp=sender,smtp_mail_options=message_options, smtp_rcpt_options=recipients_options)]
except Exception as e:
return [e]
Expand Down Expand Up @@ -154,7 +157,8 @@ def sendmail_error(env, result: SMTPResponse):
exclude_capabilities=(
"root.connection.lazy-connection", # TODO: python-emails does not handle failed auth correctly
"root.connection.eager-connection",
"root.crlf-injection-detection.detection",
"root.general-crlf-injection.detection",
"root.headers.crlf-injection.mitigation",
"root.unicode-messages.8bitmime.automatic-detection",
"root.internationalized-email-addresses.smtputf8.explicit-options"),
expected_failures=(
Expand All @@ -165,4 +169,5 @@ def sendmail_error(env, result: SMTPResponse):
# The library should problably automatically detect whether smtputf8 is required
"test_international_sender_mailbox_in_send-message_with_SMTPUTF8_support",
"test_international_recipient_mailbox_in_send-message_with_SMTPUTF8_support",
"test_Send_a_message_with_empty_recipient",))
"test_Send_a_message_with_empty_recipient",
"test_set_header_with_unicode_value")) # Encoding of unicode in header value seems wrong (underscore instead of space)
12 changes: 8 additions & 4 deletions rosetta-test-py/sendmail-redmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,14 @@ def sendmail_connected(env, sender: EmailSender):
# Send Message
#

@sendmail_suite.placeholder("sendmail-send-message-with-options")
def sendmail_send_message(env, sender: EmailSender, message, sender_address, recipient_addresses, message_options, recipients_options):
@sendmail_suite.placeholder("sendmail-send-message-full")
def sendmail_send_message(env, sender: EmailSender, message, sender_address, recipient_addresses, cc_addresses, bcc_addresses, custom_headers, message_options, recipients_options):
try:
sender.send(sender=sender_address,
receivers=recipient_addresses,
cc=cc_addresses,
bcc=bcc_addresses,
headers=custom_headers,
subject="test",
text=message)
except Exception as e:
Expand All @@ -161,13 +164,14 @@ def sendmail_error(env, result):

sendmail_suite.run(
exclude=(
"test_CRLF_detection_in_send-message_recipient",
"test_CRLF_detection_in_send-message_recipient",
"test_CRLF_mitigation_in_send-message_sender",
"test_Connect_with_invalid_credentials"), # TODO redmail leaks sockets when credentials are invalid
exclude_capabilities=(
"root.unicode-messages.8bitmime.automatic-detection",
"root.unicode-messages.8bitmime.mandatory-options",
"root.internationalized-email-addresses.smtputf8.explicit-options",),
"root.internationalized-email-addresses.smtputf8.explicit-options",
"root.headers.crlf-injection.mitigation",), # redmail does detects CRLF injections in header values
expected_failures=(
"test_Handle_421_during_data_command",
"test_Handle_421_at_start_of_data_command",
Expand Down
Loading