Skip to content

Commit

Permalink
add reply-to for send_message keywords (#1117)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikahanninen authored Oct 24, 2023
1 parent 994658f commit ff9f8e4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/source/releasenotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ Latest versions
`Upcoming release <https://github.com/robocorp/rpaframework/projects/3#column-16713994>`_
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

24 Oct 2023
-----------

- Library **RPA.Email.Exchange**: Add `reply_to` parameter for ``Send Message`` keyword.
- Library **RPA.Email.ImapSmtp**: Add `reply_to` parameter for ``Send Message`` keyword.

`Released <https://pypi.org/project/rpaframework/#history>`_
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down
4 changes: 4 additions & 0 deletions packages/main/src/RPA/Email/Exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ def send_message(
cc: Optional[Union[List[str], str]] = None,
bcc: Optional[Union[List[str], str]] = None,
save: Optional[bool] = False,
reply_to: Optional[str] = None,
) -> None:
"""Keyword for sending message through connected Exchange account.
Expand All @@ -485,6 +486,7 @@ def send_message(
:param bcc: list of email addresses
:param save: is sent message saved to Sent messages folder or not,
defaults to False
:param reply_to: email address to reply to
Email addresses can be prefixed with ``ex:`` to indicate an Exchange
account address.
Expand All @@ -510,6 +512,8 @@ def send_message(
cc_recipients=cc,
bcc_recipients=bcc,
)
if reply_to:
m.reply_to = [reply_to]

self._add_attachments_to_msg(attachments, m)
self._add_images_inline_to_msg(images, html, body, m)
Expand Down
6 changes: 5 additions & 1 deletion packages/main/src/RPA/Email/ImapSmtp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# pylint: disable=too-many-lines
import base64
import logging
import mimetypes
Expand Down Expand Up @@ -520,6 +521,7 @@ def send_message(
attachment_position: Optional[AttachmentPosition] = AttachmentPosition.TOP,
in_reply_to: Optional[str] = None,
return_path: Optional[str] = None,
reply_to: Optional[str] = None,
) -> bool:
"""Send SMTP email
Expand All @@ -536,6 +538,7 @@ def send_message(
:param in_reply_to: the 'Message ID' to which this message is in reply to,
for example `<message_id_for_reply_to>`
:param return_path: email address which should receive "bounce messages"
:param reply_to: email address which should receive the reply
**Valid sender values**
Expand Down Expand Up @@ -582,7 +585,8 @@ def send_message(
msg = MIMEMultipart()
msg["Subject"] = subject
msg["From"] = sender

if reply_to:
msg["Reply-To"] = reply_to
# The following lines optimize handling the parameters
msg_recipients, attachments, images = self._handle_message_parameters(
msg, recipients, cc, bcc, attachments, images
Expand Down

0 comments on commit ff9f8e4

Please sign in to comment.