Javascript to send email without using 3rd party service?

huangs3
huangs3 used Ask the Experts™
on
Hi Experts,

I am wondering whether there is a way to write JavaScript code to send email:
1. using known smtp information
2. neither letting user input username/password, nor hard codeing them in the JavaScript
3. not using 3rd party service

I couldn't make it because of the security, but just want to make sure whether there is a way to do that? If there is, how?
Assuming there computer account currently loged in can access email application, can it be use?
Thank you!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
It's not possible until unless you have some sort of server-side programs.

But you can always try something like this.

https://github.com/whiteout-io/smtpclient
Dave BaldwinFixer of Problems
Most Valuable Expert 2014
Commented:
peeyush gupta is correct.  Javascript does not have the ability to connect to a SMTP server to send email.  The protocols required for email are not part of JavaScript.

The only way is to use AJAX to send data to a server side program that can send email.

Author

Commented:
Thanks! peeyush gupta provides straight answer, and Dave Baldwin provides some additional conclusion to help me capture why.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial