[LIBRARY] Background Mail Library

Search This thread

krvoZD

Member
Aug 26, 2012
13
9
studioadriatic.com
This is my first library, and also the first git upload.

Library is used for background sending mail from Gmail account.



Usage if very simple:

Code:
BackgroundMail bm = new BackgroundMail(context);
bm.setGmailUserName("yourgmail@gmail.com");
bm.setGmailPassword("yourgmailpassword");
bm.setMailTo("receiver@gmail.com");
bm.setFormSubject("Subject");
bm.setFormBody("Body");
bm.send();

...and you will need permissions

Code:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

This is optional

Code:
bm.setSendingMessage("Loading...");
bm.setSendingMessageSuccess("Your message was sent successfully.");
bm.setProcessVisibility(false);
bm.setAttachment(Environment.getExternalStorageDirectory().getPath()+File.pathSeparator+"somefile.txt");

Last release

BackgroundMailLibrary 1.5

Change log:
Version 1.5
*fix #4

Version 1.4
*Added attachments support

Version 1.3
*Added password encryption for better security

Version 1.2
*Added process visibility feature

Version 1.1
*Added demo
*Bug fix

Version 1.0
*First upload

Here is link on Github

https://github.com/kristijandraca/BackgroundMailLibrary

Follow me

https://plus.google.com/u/0/+KristijanDrača
 
Last edited:

njarun

Senior Member
Sep 27, 2011
162
46
35
Kottayam
So you need to enter the username and password for it right?

This is already done and show some references or credits, people deserve it. Link i found in the stackoverflow some months before - LINK

Also using this library or this method the chances of play store app suspension is very HIGH. and Im one of the developer who faced it. My app was sending mails from background with users request. It collected username and password (but never manipulated). And ended up in app suspension!!

Now i use GMAIL AUTH for sending mails from background. And this is the preferred method since it never collect the users ID and Password. The user will be prompted to login the gmail in a web interface and if he authorize your app, the app can send mails from background without user intervention then... as simple as that, and a safe and secure way!
 

krvoZD

Member
Aug 26, 2012
13
9
studioadriatic.com
Thank you all for your interest in this project. I'm not saying it's perfect safety, feel free to add your code. I have added password encryption in the new version.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 9
    This is my first library, and also the first git upload.

    Library is used for background sending mail from Gmail account.



    Usage if very simple:

    Code:
    BackgroundMail bm = new BackgroundMail(context);
    bm.setGmailUserName("yourgmail@gmail.com");
    bm.setGmailPassword("yourgmailpassword");
    bm.setMailTo("receiver@gmail.com");
    bm.setFormSubject("Subject");
    bm.setFormBody("Body");
    bm.send();

    ...and you will need permissions

    Code:
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

    This is optional

    Code:
    bm.setSendingMessage("Loading...");
    bm.setSendingMessageSuccess("Your message was sent successfully.");
    bm.setProcessVisibility(false);
    bm.setAttachment(Environment.getExternalStorageDirectory().getPath()+File.pathSeparator+"somefile.txt");

    Last release

    BackgroundMailLibrary 1.5

    Change log:
    Version 1.5
    *fix #4

    Version 1.4
    *Added attachments support

    Version 1.3
    *Added password encryption for better security

    Version 1.2
    *Added process visibility feature

    Version 1.1
    *Added demo
    *Bug fix

    Version 1.0
    *First upload

    Here is link on Github

    https://github.com/kristijandraca/BackgroundMailLibrary

    Follow me

    https://plus.google.com/u/0/+KristijanDrača
    1
    Hi, nice idea, but if the user has to input the password, I find the intent safer and much more trusted.