I am going through the example notebook
and it works fine other than the email output. The assembly code says this:
# Asemble the message and return it
return f"Webmap ID '{webmap_item.id}' contains unreachable URLs."\
f"You can view the webmap here: {webmap_item.homepage}\n"\
f"\n"\
f"Reachable Layers\n"\
f"----------------->\n"\
f"{reachable_str}\n"\
f"\n"\
f"Unreachable Layers\n"\
f"------------------->\n"\
f"{unreachable_str}"
but the email sent has this in the email body:
Reachable Layers
----------------->
* World_Hillshade_3805
Unreachable Layers
------------------->
* plsstest_655
* CityCountyState_5586
Where is the first part and why does it not include that in the email? Any ideas?
Solved! Go to Solution.
Hi Jeff Timm , sorry we couldn't respond to this in time for GIS day demo. Happy to try to help you debug this now.
There are a few things that can be causing that message to get truncated. What email service are you using to send emails via SMTP? Sometimes different providers (gmail, yahoo mail, custom smtp servers) parse the body of the email in different ways. So you might have to look into your provider's documentation for programmatic sending of emails.
If I had to guess what you were running into, I'm guessing it's something weird with your email provider and newlines (your email starts with "Reachable Layers", the first line to be preceded by two newlines). I've seen similar behavior with newlines when I've run this code against different email providers. Can you try modifying your Python code to the following?
return f"This an email about an ArcGIS WebMap. (This line may get truncated).\n"\
f"\n"\
f"Webmap ID '{webmap_item.id}' contains unreachable URLs."\
f"You can view the webmap here: {webmap_item.homepage}\n"\
f"\n"\
f"Reachable Layers\n"\
f"----------------->\n"\
f"{reachable_str}\n"\
f"\n"\
f"Unreachable Layers\n"\
f"------------------->\n"\
f"{unreachable_str}"
I can't guarantee that will work, let me know if it doesn't!
- David
I was hoping to demo this on GIS day! Tomorrow
Hi Jeff Timm , sorry we couldn't respond to this in time for GIS day demo. Happy to try to help you debug this now.
There are a few things that can be causing that message to get truncated. What email service are you using to send emails via SMTP? Sometimes different providers (gmail, yahoo mail, custom smtp servers) parse the body of the email in different ways. So you might have to look into your provider's documentation for programmatic sending of emails.
If I had to guess what you were running into, I'm guessing it's something weird with your email provider and newlines (your email starts with "Reachable Layers", the first line to be preceded by two newlines). I've seen similar behavior with newlines when I've run this code against different email providers. Can you try modifying your Python code to the following?
return f"This an email about an ArcGIS WebMap. (This line may get truncated).\n"\
f"\n"\
f"Webmap ID '{webmap_item.id}' contains unreachable URLs."\
f"You can view the webmap here: {webmap_item.homepage}\n"\
f"\n"\
f"Reachable Layers\n"\
f"----------------->\n"\
f"{reachable_str}\n"\
f"\n"\
f"Unreachable Layers\n"\
f"------------------->\n"\
f"{unreachable_str}"
I can't guarantee that will work, let me know if it doesn't!
- David
That worked! Thanks