sending an email automaticlly - android

I have using some examples on this site to create an email class for sending a CSV file out to an email. It works find, sends the file correctly
The last line in the code reads
context.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
This as far as I understand opens the email app and lets the user send the email. I was looking to see if it was possible to send the email automatically. ie without going to the email client and not leaving my app
Thanks for your time

sending mail using the javamail-api
see this post
Send auto email programmatically
Sending Email in Android using JavaMail API without using the default/built-in app

Related

send an email with content that can not be edited

I make an application that allows users to send an email. when i use the usual procedure to send an email with intents the user is redirected to gmail app, and he can edit the mail. I would like to prevent the user from modifying the content of the email. would anyone know how to do it please?
This is too long for a comment, so I am posting the answer. The short answer is that if you rely on the user's phone as the email client, then there is no guaranteed way to prevent the user from editing the email message, because the Gmail app is out of your control. So, what you should instead do here is to use a server side webapp to send the message instead. As an example, I have used an email service (e.g. HawkHost) on the server side behind an Android app to send the message. With this setup, you can completely control what message gets sent from the user or on behalf of the user.

How to send verification code to user email in android?

When users register with my application, I want my application to automatically send some verification code to user email. I will generate verification code, but i don't know how to automatically send it to user email.
Give me some solution guys!!
NOTE!!!!!!!
I am not asking how to send email to someone which is like choosing email app and it populates subject and body in the application.
Then you have to use web services. when user register with your app, you store user registration information in server database. while inserting user record in database insert verification code in one column. (write a code to generate verification code in web service it self.) after successful inserting row in database. you can easily pick email and verification code. Now you have all details of user. Write a code in web service to send verification code in email to user.
Normally its done from the server side. Generating authentication token and sending it to a mail address using an SMTP server. for example mail in php.
If you really want to do it on android side which doesnt open any application and directly sends a mail to gmail, here is an alternative I could find.
Sending Email in Android using JavaMail API without using the default/built-in app
firebase email verification is the best to verify the email without using any custom created service (API)

Registering intent filter to open email attachment from Gmail and native mail through my app

In my app I am generating custom files with my own extension.
I have to send these files as an email attachment, and receiver's side I have to open this attachment through my application.
For this I got a reference.
Android: Registering Intent Filter to open email attachment with my app
This is working fine for Gmail attachments and not for native mail clients.
means I am able to open Gmail attachments but can't native mail attachments.
Can anyone suggest the way which will work for all email clients.
Regards,
Pradeep_ch.
Can anyone suggest the way which will work for all email clients.
There is no way that will work with all email clients. There is no requirement that an email client retain your file's extension in the Uri that it uses with ACTION_VIEW.

Email intent back to activity

Can anyone tell me how to redirect email intent's back button to activity where send mail button is present. I was succeeded to send mail from my android app by using email intent.But I want the flow to be exists only in my app without opening mail inbox. Can anyone help me?
If you want to send the email from your app you will have to implement IMAP or SMTP protocols in your application. There may be some third-party libraries available already
And if you're asking about behavior of the GMail app after it proceeds your intent, you can't alter it
Yes it is possible for that you have to build the Php backend(webservice) for sending email, in that you can put subject,recipient address and message with that webservice.

how to send mail directly in android?

In my requirement i need to send a mail directly when user click on the send button without using intents.I have done it with java mail API.But it ask password.Can i send without giving my password?. Is it possible with any other ways? Please tell me.I used bellow link for sending mail.
http://androidcodeexamples.blogspot.in/2012/05/android-send-email-via-gmail-actually.html
Thanking in Advance.
To answer your question I first ask you one.. Can you send mail with any of the available acount without logging in with your password? the answer is no. Because before sending mail you need to authenticate your acount with password. So this is must. If you can send mail without password then anybody can do the same which is definitely not wanted.
Can i send without giving my password?
Your mail server administrator is unlikely to allow password-less email sending, as soon a billion spammers will use your mail server.
You are welcome to write a Web service that will send email to your dedicated "contact-us" account. Or, have the Web service store the "contact-us" information elsewhere, such as a database.
You need to to authenticate to send mails. If you device already has applications you can use intents which will allow you the user to make a choice to sent mails using the desired application.
To send mails using intents
http://www.mkyong.com/android/how-to-send-email-in-android/
You can also hard code username and password and sent mails using javamail api.
Sending Email in Android using JavaMail API without using the default/built-in app
The above requires users to have gmail account.

Categories

Resources