I want to send email from my application by adding "on behalf of" address. Currently I am using apache common Email to send email and it seems I couldn't specify sender in there. As I can see email headers I need to set different values for sender and from to show email receive as "on behalf of" in the mail client.
Can anyone please help me to do this using java email client or can I achieve this using same apache common client? Solution needs to be work with most of common email clients like outlook, gmail etc..
As per link
you can do
msg.addHeader("Sender", "My Friend <xxxxxx#xxxxx.com>");
Related
I want the email to be sent immediately, currently the application is showing me installed email applications in device where I can recompose the email before sending, I want to send the mail directly without showing installed applications.
I Know javamail but need email .. other user can decompiler app and theft email :)
The way to go is to send the mail via some server, not directly from the device. You would, for example, connect to a REST API that sends out the email for you. Sending an email directly from the device from the user's email address is not (and should not be) possible
There are two ways to send email from android application directly without any intent
using SMTP & JavaMail API follow the link for details
using Webservice( for example PHP script ) so there is a server side code and you hit that URL with param like ( name,subject etc) so basically PHP code send mail at the end and it's very easy to use .
Personally, I suggest you use Webservice because it's simpler than first approach.
** Edit: You can save email in sharedpreferences or database and fetch it from there when you try to send mail rather than hardcoding it to avoid theft email risk.(directly putting mail address inside code)
Anyway you can prevent other from getting your full source code.See this answer
I have a query in which I need to send email from my email id to a large group of people.
I have an excel file, which contains email address of people across the world with several domain names. I am reading these email and trying to send it but I get the error stating "cannot send email"
Probably I am using wrong SMTP names.
However when I send email to people in my domain, I am able to do so.
I want to have the same "From" address and different "To" address. Please let me know if this is possible.
e.g From: address#somedomain.com
To: address#other domain.com
Regards
Bipul
Yes, this is possible. Normally all the messages would be sent to your smtp server, which would forward them to the appropriate mail server for the recipient's domain. Your smtp server may be rejecting some of the messages if it's not configured to allow you to relay messages outside your domain. Possibly it won't let you do this because you haven't authenticated to your mail server.
I have developed an app with a login. To help users I would like to send a mail reminding their credentials.. 2 solutions but 2 problems:
1) If I send the mail from the mobile phone (using my gmail account and mail.jar library) Google always reports a possible violation of my account or a suspect access, blocking it. I read several forum page about remove this feature but some people say that Gmail is built to be used by a single person
2) If I send a mail from a php page (using the function mail($mailto,$subject,$message,$header) several mail server put automatically this email into the trash folder.
Any suggestion? How to solve this issue?
Thank you in advance
You could send mail in java (mail.jar or mailServices of Spring Framework). I suggest you to use a mail provider service to send mail. It's better because there many things to care with when you send email ( email does not exist, delay of receiving the email, the current status of email sent, received or read...)
I have just started using mailgun. I am facing an issue. Lets say my domain is test,I have done this
abc#gmail.com--> support#test.mailgun.org --> myAccount#gmail.com
SO I am able to route incoming msgs coming to my gmail account, Now I want if I reply from gmail account to the particular user it should appear like that it is sent from support#test.mailgun.org.
myAccount#gmail.com --> abc#gmailc.com (appeared as it is sent from support#test.mailgun.org)
is it possible????
Language:- Java
Thanx to #Andersen, I got the solution. In gmail we have option in which we can change our mail id and make it look like it is coming from some different id while replying.
1) Go to settings in gmail
2) Click on Accounts
3) Send mail as: Click on Add another email address you own
4) Provide the email id you wish to appear as "Sender ID"
5) provide SMTP connection details which you can see once you login to your mailgun account and click on domain.
6) Save the settings, now when you are replying we can change from id to our custom domain id.
Enjoy
You need something to make the message leave your gmail inbox.
This can either be a rule in gmail itself (been a while, do not know what forwarding rules they have at the moment) or to use a client that reads a mailbox and resend the messages.
This is what the Unix utility fetchmail does, but you can easily use the java mail package to access gmail using IMAP and then create new messages based on these which you then send though your own SMTP server.
If at all possible use existing code! This is a bit tricky to get 100% right.
i have requirement that i need to send/receive email after successful login by user, upon click on email verification i will activate the user . i dont have dedicated smtp server for send/receive mails for this requirement. right now i am looking for free service for initial start up options , i gone through this http://www.mkyong.com/java/javamail-api-sending-email-via-gmail-smtp-example/ for sending email through gmail. my question is can i receive mail using gmail smtp service?
Short answer: No, not with SMTP. But probably with IMAP/POP.
Long answer: SMTP is only used for sending email between MTAs (Mail Transfer Agent). You'll have to download the email from your email provider, google in this case, using IMAP or POP.
You'll have to connect and check regularly as without an MTA service on your end, you can't get email pushed to you. Most personal ISPs block outbound port 25 so setting up a MTA might be tricky as you have to figure out your providers SMTP relay (if they even have one!)
See here for enabling IMAP/POP support for gmail:
https://support.google.com/mail/troubleshooter/1668960?hl=en
Google will find you a suitable imap/pop client library to use with java.
Edit:
If you are doing a regular e-mail verification step for a website registration, you don't need to receive an e-mail from the user. You send them an e-mail with a a link to your websites verification URL. The link contains a predetermined ID, say the sha1 sum of username + e-mail encoded into the URL. The user clicks the link and opens a specific page on your site where you verify the ID when the page is loaded. This is how it is usually done. This way you don't need to receive any email programmatically.
Unless receiving it by email is a specific requirement from your customer, in which case you can ignore this edit. :)