Hello again. I want to send a simple e-mail to members from an ArcGIS Online Group. A general version of the script is provided at the bottom. PLEASE help me if you know how to format the email_body for the (it appears) smtp message.
My main concern is FORMATTING the email_body because the message protocol clearly does not recognize Python string delimeters - the newlines and tabs are not being produced, just one long sentence basically.
I have found really helpful resources for more heavy-duty automated messaging (for instance: Send Email When a Feature is Added to an ArcGIS Online Hosted Feature Service ) BUT it does not appear I can access e-mails of Group members, so I am confined to the Arcgis Python API using the Group.notify method.
from arcgis.gis import GIS
from arcgis.gis import Group
# get gis object
my_gis = GIS(username = <my_username>, password = <my_password>)
# Group User Info: dict with keys - owner, admins, users
my_group = Group(my_gis, <group_id_number>)
members_dict = my_group.get_members()
# give me list of user names from group
group_users = members_dict['users']
subject = 'Changes and updates to group'
signature = 'Zach <Lastname\>nGIS Specialist\n(123) 456-7890\tmyemail.com'
email_body = '''Hi everybody,\n\nWe have changed some content and protocol
updated and added metadata to the existing datasets -
feature layers and shapefiles - and did other stuff.
\n\nFeel free to contact me if you have questions.
\n\n'''.format(signature)
my_group.notify(group_users, subject, email_body, 'email')