cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
utsav_ghosh1
Level: Power Up

How to send email from PowerApps when device is offline

I am using Office365.SendEmail() to send email. I wanted to know when there is no connectivity, how to store the email and send it again when there is connectivity

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: How to send email from PowerApps when device is offline

Hi @utsav_ghosh1 ,

Do you want to store the email locally when there is no connectivity?

 

If you want to store the email localy when there is no connectivity, I afraid that there is no direct way to achieve your needs in PowerApps currently.

As an alternative solution, you could consider store the email argument, subject argument, body argument, .... within your Office365.SendEmail(...) into a collection, then save the collection into your local device when there is no connectivity.  When there is connectivity, load the local cacahed collection, then send your email again.

 

Based on the needs that you mentioned, I think a Timer control and SaveData, LoadData function could achieve your needs. I have made a test on my side, please take a try with the following workaround:

Set the OnSelect property of the "Send Email" button in your app to following:

If(
    Connection.Connected,
    Office365.SendEmail(...),
    ClearCollect(
EmailTemp,
{
Email: "The email address you typed in above Office365.SendEmail() function", /* <-- Maybe the email address, subject content, body content are referenced from other Text Input box controls, so here, you need to type corresponding refernece formula*/
Subject: "The subject content you typed in above Office365.SendEmail() function",
Body: "The body content you typed in above Office365.SendEmail() function"
}
);SaveData(EmailTemp, "LocalEmail") )

 

Then add a Timer control in your app, set the Duration property to following:

1000

set the AutoStart property and Repeat property to following:

true

set the OnTimerEnd property to following:

If(
   Connection.Connected,
LoadData(EmailTemp, "LocalEmail", true);Office365.SendEmail(First(EmailTemp).Email, First(EmailTemp).Subject, First(EmailTemp).Body) )

More details about designing an Offline app in PowerApps, please check and see if the following blog would help in your scenario:

https://powerapps.microsoft.com/en-us/blog/build-offline-apps-with-new-powerapps-capabilities/#targe...

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/offline-apps

 

Note: Your could not use SaveData function and LoadData function inside a browser, either when authoring the app in PowerApps Studio or when running the app in the web player. To test your app, run it in PowerApps Mobile on an iPhone or Android device.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 REPLIES 2
RezaDorrani
Level 10

Re: How to send email from PowerApps when device is offline

Hi @utsav_ghosh1 

 

You would have to use the LoadData and SaveData functions for offine actions

Note: they only work when using the App on a mobile or tablet device

Will not work for browsers since data cannot be saved locally

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/offline-apps

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Community Support Team
Community Support Team

Re: How to send email from PowerApps when device is offline

Hi @utsav_ghosh1 ,

Do you want to store the email locally when there is no connectivity?

 

If you want to store the email localy when there is no connectivity, I afraid that there is no direct way to achieve your needs in PowerApps currently.

As an alternative solution, you could consider store the email argument, subject argument, body argument, .... within your Office365.SendEmail(...) into a collection, then save the collection into your local device when there is no connectivity.  When there is connectivity, load the local cacahed collection, then send your email again.

 

Based on the needs that you mentioned, I think a Timer control and SaveData, LoadData function could achieve your needs. I have made a test on my side, please take a try with the following workaround:

Set the OnSelect property of the "Send Email" button in your app to following:

If(
    Connection.Connected,
    Office365.SendEmail(...),
    ClearCollect(
EmailTemp,
{
Email: "The email address you typed in above Office365.SendEmail() function", /* <-- Maybe the email address, subject content, body content are referenced from other Text Input box controls, so here, you need to type corresponding refernece formula*/
Subject: "The subject content you typed in above Office365.SendEmail() function",
Body: "The body content you typed in above Office365.SendEmail() function"
}
);SaveData(EmailTemp, "LocalEmail") )

 

Then add a Timer control in your app, set the Duration property to following:

1000

set the AutoStart property and Repeat property to following:

true

set the OnTimerEnd property to following:

If(
   Connection.Connected,
LoadData(EmailTemp, "LocalEmail", true);Office365.SendEmail(First(EmailTemp).Email, First(EmailTemp).Subject, First(EmailTemp).Body) )

More details about designing an Offline app in PowerApps, please check and see if the following blog would help in your scenario:

https://powerapps.microsoft.com/en-us/blog/build-offline-apps-with-new-powerapps-capabilities/#targe...

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/offline-apps

 

Note: Your could not use SaveData function and LoadData function inside a browser, either when authoring the app in PowerApps Studio or when running the app in the web player. To test your app, run it in PowerApps Mobile on an iPhone or Android device.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, September 18th at 8am PDT

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 48 members 4,701 guests
Please welcome our newest community members: