Sending an email

Discussions about creating CAPI applications to run on Android devices
Forum rules
New release: CSPro 8.0
Post Reply
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

Sending an email

Post 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
Best
Ari
sherrell
Posts: 397
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

Re: Sending an email

Post 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
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

Re: Sending an email

Post 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
Best
Ari
sherrell
Posts: 397
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

Re: Sending an email

Post 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
htuser
Posts: 631
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: Sending an email

Post 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,
G.VOLNY, a CSProuser from Haiti, since 2004
Post Reply