Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Applets
Expertise: Beginner
Jul 23, 1997



Application Security Testing: An Integral Part of DevOps

Writing applet to send info from forms to email address

I am wondering if I can write an applet that will send information from a number of forms to my email address without all the %$= etc. and without using CGI scripts (my server doesn't allow CGI scripts).

If the SMTP port (25) on your web server hasn't been disabled by the system administrator, you can open a socket to it and mimic the SMTP protocol. Let's say your host is www.sun.com:

Socket s = new Socket("www.sun.com", 25);
   PrintStream out = newPrintStream(s.getOutputStream());
Then send the string:
 HELO xxx
   MAIL FROM: yyy
   RCPT TO: baker@www.sun.com
Note the misspelling of "HELO". I've done this on purpose to make the point that the xxx and yyy can be anything; SMTP doesn't check. Don't miss the "." on the second-to-last line.
DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date