New Line in notification and email

569
3
08-27-2021 09:07 AM
by Anonymous User
Not applicable

Hi, 

Wanna send multi-line email using ArcGIS python API. 

       import arcgis
       gis = arcgis.gis.GIS("home")
       all_users = arcgis.gis.UserManager(gis)
       me = gis.users.me
       msg = " a line \n a new line"
       print(msg)
       all_users.send_notification([me], subject='test new line', message=msg, type='email', client_id=None)

But email arrives as one line. 

0 Kudos
3 Replies
Kara_Shindle
Occasional Contributor III

Try the {sep} and formatting it like below:

	msg = (
		f"From: {fromaddr}{sep}"
		f"To: {toaddr}{sep}"
		f"Subject: New complaint - {requestType}"
		f"{sep}"
		f"A new complaint has been made: {sep}"
		f"Type of Problem: {requestType}{sep}"
		f"Name: {contact}{sep}"
		f"Date Submitted: {datetime.datetime.fromtimestamp(int(submittedOn)//1000)}{sep}"
		f"Details: {details}{sep}"
	)

 

0 Kudos
by Anonymous User
Not applicable

Hi @Kara_Shindle 

Thank you very much for your answer. I have tested with different separators as sep without any success. 

0 Kudos
BlakeTerhune
MVP Regular Contributor

What email client are you using? I've seen Outlook attempt to remove what it thinks are extra line breaks, causing some content to appear as a single line.

0 Kudos