• Post Reply Bookmark Topic Watch Topic
  • New Topic

Could we use JavaMAil if the sender doesn't use an e-mail address from gmail mail server?  RSS feed

 
John Verger
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I use JavaMail API since 2 months, and what I've noticed is that, when a person P1 uses JavaMail to send a mail to a person P2, the person P1 must use an e-mail adress from gmail. For example, if the person P1 uses his e-mail address from yahoo.com, there will be an error-message in the process of sending a mail to the person P2.
I would want to know if my remark above is true. And if it's true, could someone tell me how the person P1 could use Java to send a mail to a person P2, if the person P1 has a mail address at yahoo.com and no address at gmail?


Thanks.
 
Marcus Biel
Ranch Hand
Posts: 51
IntelliJ IDE Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There must be something else you got wrong. Java Mail is just the standard Oracle Java API, a generic api to write any kind of email: http://www.oracle.com/technetwork/java/javamail/index.html

This means you should be able to send emails from and to any kind of email address / provider.
 
Paul Clapham
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you're asking about what e-mail address you can send your messages FROM, when using JavaMail. The answer is that you should use an e-mail address which belongs to the domain from which you are sending the messages. Otherwise, what's to stop you from sending a message which claims to be from my Yahoo address? You would then be impersonating me, and that's not something which should be supported by something like JavaMail. That's just wrong.

If sending a message from your Gmail account is working, that's probably because you have something in your code which authenticates the e-mail address you're sending from. Perhaps Yahoo has a similar process -- you could check out their site and see. But really you should have your own domain and use an address belonging to it.
 
Marcus Biel
Ranch Hand
Posts: 51
IntelliJ IDE Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote: The answer is that you should use an e-mail address which belongs to the domain from which you are sending the messages. Otherwise, what's to stop you from sending a message which claims to be from my Yahoo address? You would then be impersonating me, and that's not something which should be supported by something like JavaMail. That's just wrong.


That would not be nice and so is called SPAM, but technically there is nothing stopping anyone to use any email address in the from or to address field -
The only one who could stop that would be the mailserver where this is running on. If that's your own server, you are unfortunately free to spam the world (and that is what happens every second a trillion times world wide :-( )
 
Paul Clapham
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can indeed send e-mail using any from-address you like, but nowadays reputable e-mail agents will try to check that the message is actually coming from the server which the from-address claims it's coming from.

Of course John hasn't told us anything about those error messages so it's pretty hard for us to try and interpret the problem, isn't it?
 
Marcus Biel
Ranch Hand
Posts: 51
IntelliJ IDE Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems like John - is gone! ;-)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!