Hi,
I am working on an offline app that contains in some pages email send
is it possible to send email while offline ( save it offline) and send it back once connected automatically
i mean like savedata() and loaddata()
Thank you

Hi,
I am working on an offline app that contains in some pages email send
is it possible to send email while offline ( save it offline) and send it back once connected automatically
i mean like savedata() and loaddata()
Thank you
Hi @charbelarmaleh :
Do you wish to achieve the following functions:
As you might expect, using savedata() and loaddata() can easily achieve this function.I've made a test for your reference:
1\Add a button:
Text
If(
Connection.Connected,
"Send an Email",
"Send an Email(OffLine Mode)"
)/*When the app is in offline mode, it displays "Send an Email(OffLine Mode)"*/
OnSelect
If(
Connection.Connected,
Office365Outlook.SendEmailV2(
"bof@xx.com",
"Subject",
"Body"
),/*When the device is online, send email directly*/
Collect(
EmailWaitingToBeSent,
{
To: "bof@xx.com",
Subject: "Subject",
Body: "Body"
}
);/*When the app is in offline mode, the content of the mail to be sent is stored in a collection named EmailWaitingToBeSent*/
SaveData(
EmailWaitingToBeSent,
"Emails"
)/*Save the collection EmailWaitingToBeSent to the local*/
)
2\Set the app's OnStart proeprty to :
LoadData(
EmailWaitingToBeSent,
"Emails"
);
If(
Connection.Connected && CountRows(EmailWaitingToBeSent) > 0, /*When the device is online and there are records in EmailWaitingToBeSent, send an email and clear the collection EmailWaitingToBeSent*/
ForAll(
EmailWaitingToBeSent,
Office365Outlook.SendEmailV2(
To,
Subject,
Body
)
);
Clear(EmailWaitingToBeSent);
SaveData(
EmailWaitingToBeSent,
"Emails"
)
)
Note: Emails saved locally can only be sent automatically when the device is online and the app is reopened.
-------------------------------------------Optional step-----------------------------------------------------
If you want to check the connection status of the device in real time, send the mail stored locally in real time. Then you need to use a timer control.
Add a timer control:
AutoStart
true
Duration
1000/*loop in 1s*/
OnTimerEnd
If(
Connection.Connected && CountRows(EmailWaitingToBeSent) > 0,
ForAll(
EmailWaitingToBeSent,
Office365Outlook.SendEmailV2(
To,
Subject,
Body
)
);
Clear(EmailWaitingToBeSent);SaveData(
EmailWaitingToBeSent,
"Emails"
))
Repeat
true
Visible
false
Best Regards,
Bof