Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8132765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:25:19+00:00 2026-06-06T09:25:19+00:00

This is a little mailing script that gets the information from the form and

  • 0

This is a little mailing script that gets the information from the form and then sends a mail.
It works like a charm only one problem is that the from address and the subject isn’t working. The mail comes without a from address and without a subject.

Someone that knows what’s wrong?

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException, Exception {
    response.setContentType("text/html;charset=UTF-8");
    //PrintWriter out = response.getWriter();

    //SMTPserver en de mail naar waar de mensen hun mail versturen
    String smtpServ = "uit.telenet.be";
    String to = "ddd@gmail.com";


    String from = request.getParameter("mail");
    String subject = request.getParameter("subject") + "geschreven door: " + request.getParameter("naam");
    String emailContent = request.getParameter("beschrijving");

    response.setContentType("text/html");
    try {

      sendMessage(smtpServ, to, from, subject, emailContent);

    } catch (Exception e) {

      throw new ServletException(e.getMessage());

    }
}       


private void sendMessage(String smtpServer, String to, String from,
    String subject, String emailContent) throws Exception {
 try{
     SmtpClient client = new SmtpClient(smtpServer);
     client.from(from);
     client.to(to);
     PrintStream message = client.startMessage();
     message.println("Naar: " + to);
     message.println("Onderwerp:" + subject);
     message.println(emailContent);
     message.println();
     message.println("Het Burgerdemocratie Team");
     message.println();     
     message.println();
     client.closeServer();
  }
  catch (IOException e){    
     System.out.println("ERROR tijdens het verzenden van de mail:"+e);
  }

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T09:25:20+00:00Added an answer on June 6, 2026 at 9:25 am

    You forgot to add to sendMessage() method this:

    message.println("To: " + to);  
    message.println("Subject: " + subject);  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this little script to toggle a contact form when a button is
I have this little form that has a button loading a little icon onto
found this little code snippet that seems to do what i want, but im
I have wrote this little script which generates a nice random password. The problem
I have this little hover script. $('iframe').hover(function() { $('.caption').fadeIn(800); }, function() { $('.caption').fadeOut(800); });
This little fiddle shows the problem I'm having. The login form on the right
In this little piece of code, what is the fourth line all about? from
This little OpenLayers.Control.EditingToolbar from is inserted by default: It's not really evident what these
This little line of code here is from a shopping cart: <a href=javascript:; onclick=simpleCart.add(
I am writing this little python program that will get new posts on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.