• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Select and unselect in textarea

 
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Google seems to have put some security restrictions.  They are probably not allowing signing from any external app.  I tried your same code, using my credentials, and received one security alert email from google.  Just check you might have something like this in your mail box too.
 
Ranch Foreman
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No I am not getting any alert mail from google. I checked in spam too.
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the same error message what you got, and on the first run of your code got an alert email as well with this message Google prevented someone from signing in to your account using a non-Google app.
 
Gayathri Gayu
Ranch Foreman
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes yes i got the security alert mail.
 
Gayathri Gayu
Ranch Foreman
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do we need to give any more access for sending mails?
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying to figure out, I also faced it for the problem for first time.
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might get some information here

https://support.google.com/accounts/answer/185833
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I figured it out.  Once you go to that page.  There is a link as Google Account.  Once the next page opens click on Security on the left panel.  Now scroll down and you will find an option as Less Secure Apps.  By default that's off.  Change it allow access to less secure apps. It will show a message as updated. Now try running your code.
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you use my mail id to test.  I got the mail.
 
Gayathri Gayu
Ranch Foreman
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I Just tried with your gmail id. Did you got any mail?
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes...
 
Gayathri Gayu
Ranch Foreman
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Swastik Dey wrote:Did you use my mail id to test.  I got the mail.


Yes i used your mailid for testing
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So it worked finally.
 
Gayathri Gayu
Ranch Foreman
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's mentioned in that mail? Because i didn't received any mail till now.
 
Gayathri Gayu
Ranch Foreman
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Allow less secure apps: ON my app secure is on only
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How will you receive the email.  You are sending to me.  I am replying from there and see what I got.
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I replied from there, and if you wish to receive the copy of that email in your mail box too along with to , use cc or bcc
 
Gayathri Gayu
Ranch Foreman
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Gayathri Gayu wrote:I Just tried with your gmail id. Did you got any mail?

You asked me na. Whether i got any mail. For that I told i didn't get.
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh sorry I got it wrong.
 
Gayathri Gayu
Ranch Foreman
Posts: 316
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help. I guess i have learned something very new to me. thanks again.
 
Gayathri Gayu
Ranch Foreman
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can add the login page link too in the message right?
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course you can.
 
Gayathri Gayu
Ranch Foreman
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So is it that everyone should on their security service for the Access for less secure apps has been turned Then only the will receive mails?
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Google seems to have added this security.  Nothing wrong with your code.  If any non-google app in this case your webpage/site uses your google credentials it is required to be set to on.  There is one more way using a 16 digit app password, but I am not very sure how it works.  Not everyone, receivers have got nothing to do with this.  This should be set to on for you who is sending the mail.
 
Gayathri Gayu
Ranch Foreman
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So when the user registers they should create a 16 digit password. Is it?
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, As i said, receivers have got nothing to do with this.  The settings are for the sender in this case it's you.  You can either set the allow access to less secure apps on or you can set a 16 digit app password.
 
Gayathri Gayu
Ranch Foreman
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
App password means my gmail password or the app which i am creating it's password. And if so i am changing this i can off my access to less secure apps
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are probably still little confused.  If any non-goggle app (your web page/site) is using your credentials to send mail there are two ways

1.  Allow less secure apps on (you already have this)

or

2. Create a 16 digit password from google web site  to allows access to non-google apps. ( I am not sure about this how it works)

As you have already enabled the 1st one you don't need the 2nd one as it's a either or condition.  I hope I am clear.
 
Gayathri Gayu
Ranch Foreman
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to hide my mailid. Is that possible to do when sending the mail? I just edited the code in SendMail class
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think so.  There might be some other way, not sure, have to look.
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this

 
Gayathri Gayu
Ranch Foreman
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. It didn't get changed. no-reply@abc.com <gayathri13990@gmail.com> I am getting the mail like this.
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I got it wrong.  Let me check once again.
 
Gayathri Gayu
Ranch Foreman
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got the mail?
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think it's doable because google is taking the actual details from this part



and whatever you set in setFrom is sort of label displayed to the user.  This is what I got from you.

no-reply@abc.com <gayathri13990@gmail.com>
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure, if there is some other way out.
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I think, in a real time scenario best option is don't use your personal email create a separate email id for this purpose.
 
Gayathri Gayu
Ranch Foreman
Posts: 316
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes @Swastik That's what i am going to do.
 
Swastik Dey
Master Rancher
Posts: 2249
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just one more thought/suggestion.  Put the registration and mailing code in a servlet not in jsp.  Just produce the output to the user using jsp, and instead of hard coding your mail id and password in the code keep in some properties file and read from there.
 
Gayathri Gayu
Ranch Foreman
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So is now everything is in jsp and not in servlet? Do i need to modify the entire project code?   I couldn't understand this instead of hard coding your mail id and password in the code keep in some properties file and read from there. Please explain me
 
Evil is afoot. But this tiny ad is just an ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!