Page 1 of 1

Sending an email

Posted: August 29th, 2021, 9:33 am
by AriSilva
I need to print a specific report (it was created as a .txt file in my android application), and I´ve thought about sending an email attaching this report, for the email´s receiver to be able to print it.
How can I do that? That is, how can I call an email application in Android from inside my csentry application?
Best
Ari

Re: Sending an email

Posted: August 29th, 2021, 10:05 pm
by sherrell
Hi Ari,

You can use the systemApp or execSystem functions.

See https://www.csprousers.org/help/CSPro/systemapp.html

and https://www.csprousers.org/help/CSPro/e ... obile.html

Sherrell

Re: Sending an email

Posted: August 30th, 2021, 8:23 am
by AriSilva
Thank you, Sherrell,
I´ve already used the execsystem function, for example, to show reports, either as txt or pdf files, and also to call my own applications, but I´ve never used it to call a mail application, and the helps you´ve suggested do not have any examples for that purpose.
1. How do I call the mail application?
2. How do I give it the sender and receiver addresses parameters?
3. How do I attach a file to the email?
Things like that.
Best
Ari

Re: Sending an email

Posted: August 30th, 2021, 2:14 pm
by sherrell
Hi Ari,

Well, I thought I was getting off easy. You just said you wanted to call an email application, not do all the other tasks (tho I had a feeling that's what you wanted).

>1. How do I call the mail application?
  SystemApp email;

  email.setArgument(
"https://login.yahoo.com");     // URL of your email system's login screen
 
email.exec ("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe");
However, the interviewer/user would have to go through the login process, as I don't know of any email system that allows parameters to be passed in to it, unless a 2-step authentication process is used--which then defeats your purpose of making this a hands-free operation. I imagine this is a security issue, for if mail systems allowed this type of single-pass-login parameters they'd be deluged by hackers trying the same thing.

>2. How do I give it the sender and receiver addresses parameters?

You'll have to write that info out to a file for the email system to find. That said, any file that you want an external program (i.e., outside CSEntry) to find which is running Android 10 or higher would have to find that program in the shared public storage; for only CSEntry has rights to its folder.

>3. How do I attach a file to the email?

Same issue as #2, whatever file you want to send them would have to be copied outside of the CSEntry folder to a shared public folder in order for the mail program to have access to it.

Sherrell

Re: Sending an email

Posted: August 30th, 2021, 7:21 pm
by htuser
Dear all,
Once again, the easiest way is javascript libraries:
1.- Send from the client side : https://smtpjs.com/, an example: https://netcorecloud.com/tutorials/how- ... avascript/;
https://www.geeksforgeeks.org/how-to-se ... avascript/
It offer encryption option to protect your credentials.
Support for files attachments.
2.- https://www.emailjs.com/ can send email with attachments, but some options require payments.

Note that almost all mail services (Gmail etc.) will give you smtp parameters (https://support.google.com/mail/answer/ ... ail-client).
With the future support of CSPro logic functions in Javascript, this will facilitate lot of request.

Best,