Attach photo to email in custom email popup

870
10
05-09-2019 11:52 AM
ScottEvans6
New Contributor III

To All,

I have created a custom email popup within a web map. It uses the 'mailto:' protocol to achieve this, similar to what is in this link:  https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/send-email-from-web-map-pop-ups/   . I have also been able to use some arcade functions as well to grab things such as local time, lat and long, and other information to populate the email. What I want to do is attach the photos in the popup, into the email that is generated. I know Arcade has an attachment function, but is used to get attachments counts and properties (size, etc.). Has anyone accomplished this feat yet?

Thanks,

Scott

0 Kudos
10 Replies
XanderBakker
Esri Esteemed Contributor

I don't think this is possible in a single mailto url. The Attachments function will get you a collection of Attachments that will provide access to the name and ID of the attachment, but how will you attach the file to the email?

See also this blog: https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/visualize-your-attachments-in-arcgis...

0 Kudos
ScottEvans6
New Contributor III

Xander,

I was hoping there was some way through arcade to maybe get the BLOB information from the attachment, and place it in the email with an alias, or as an attachment to the email. 

Scott

0 Kudos
XanderBakker
Esri Esteemed Contributor

I haven't seen this type of functionality before, but it would be nice.

0 Kudos
ScottEvans6
New Contributor III

Ok, I figured I would put it out there. Thanks for the quick response!

0 Kudos
XanderBakker
Esri Esteemed Contributor

There would be another challange... I just saw this post on Stack Overflow:  https://stackoverflow.com/questions/5233556/using-mailto-to-send-email-with-an-attachment which mentions that the mailto could (should) link to a URL. If you would be able to construct the link to the attachment (I assume using the ID propperty of the attachment) it will likely need a token to access the URL and tokens expire.

ScottEvans6
New Contributor III

Yeah, I saw that too. I have done this using desktop, with a feature service on our ArcServer environemnt, and a python script. But to do it using pure AGOL seems to not be there yet.

0 Kudos
XanderBakker
Esri Esteemed Contributor

To provide some additional info, there is a nice video posted by Jennifer Bell

https://www.youtube.com/watch?v=MzfxBskoon8

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Scott Evans ,

This is what I have found out:

  • It will not be possible to include an attachment from a simple href mailto link
  • You can however, include a link to the attachment so that the receiver con open the attachment
  • The attachments (hosted feature service) should be publically shared
  • I tried including a script in the pop-up window that creates the mailto link and use a button with a new window to open the link, but the script is stripped from the pop-up window and will not work

This is what is returned:

... with a simple mailto link like this:

<a href="mailto:someone@somewhere.com?subject=my report&amp;body=see attachment: {expression/expr0}&amp;attachment={expression/expr0}">Send email</a>
ScottEvans6
New Contributor III

Ok. The issue is that the feature services are mostly non-public. This creates the other issue of the tokens... I am thinking at this point it might not be possible, unless I bring the application into a development environment and go from there.