I created and hosted a JEE application and I have a jsp page named contact.jsp from which a user can send me an email. I can use "mailto" link for that but I want to send the mail from my jsp page.
Yes,I know how to send an email with the JavaMail API:
This code send the message from my SMTP server to the user address mail for example, but I want to do the opposite i.e sending the message from the user to my SMTP srver.
Deparis Momo wrote:... but I want to do the opposite i.e sending the message from the user to my SMTP srver.
But it doesn't make sense for you to send a message from somebody else. You have to wait for them to send the message. And for that, the mailto link is the normal way to enable them to send a message. So, what do you want to do which a mailto link doesn't already do?
Just bear in mind that the example you linked to doesn't exactly allow the user to send you an e-mail. It allows the user to input certain information, including an e-mail address, and then the server does something with that information. It's possible that it puts the information into a database and then a responsible person will deal with new rows in that database, or it's possible that it sends an e-mail to that responsible person. In the latter case it's most likely that the e-mail comes from the system; trying to send e-mails on behalf of other people is a tricky business and it will often look like spam to mail servers.