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 8553317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:37:26+00:00 2026-06-11T14:37:26+00:00

i am using struts 2.0 hibernate 3.0 and tiles 3.0 for my website and

  • 0

i am using struts 2.0 hibernate 3.0 and tiles 3.0 for my website and i want to send mail to info@shreerajinvestment.com
but i m not able to send mail on that so what i have to do …..

http://shreerajinvestment.com/Home/send_feedback.action

package admin;

import java.util.Properties;

import javax.mail.Message;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

public class SendMailFeedback {
    private String from;
    private String to;
    //private String cc;
    private String subject;
    private String password;
    private String text;

    public SendMailFeedback(String from, String to, String subject, String text, String password)
    {
        this.from = from;
        this.to = to;
        //this.cc = cc;
        this.subject = subject;
        this.text = text;
        this.password = password;
    }

    public void send() throws Exception
    {
        System.out.println("Send FeedBack");
        try 
        {
            Properties props = new Properties();
            props.put("mail.smtp.host", "smtp.gmail.com");
            props.put("mail.smtp.socketFactory.port", "465");
            props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
            props.put("mail.smtp.auth", "true");
            props.put("mail.smtp.port", "465");

            Session session = Session.getDefaultInstance(props,new javax.mail.Authenticator(){protected PasswordAuthentication getPasswordAuthentication(){return new PasswordAuthentication(from,password);}});

            Message message = new MimeMessage(session);
            message.setFrom(new InternetAddress(from));
            message.setRecipients(Message.RecipientType.TO,InternetAddress.parse(to));
            //message.setRecipients(Message.RecipientType.CC,InternetAddress.parse(cc));
            message.setSubject(subject);
            //String link="www.shreerajinvestments.com";
            message.setText(text);
            System.out.println("MAIL");
            Transport.send(message);
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
}

package admin;

import com.opensymphony.xwork2.ActionSupport;

public class sendFeedback extends ActionSupport
{
    private static final long serialVersionUID = 1L;

    private String name;
    private String email1;
    private String sub;
    private String msg;
    private String contact;

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }

    public String getEmail1() {
        return email1;
    }
    public void setEmail1(String email1) {
        this.email1 = email1;
    }
    public String getSub() {
        return sub;
    }
    public void setSub(String sub) {
        this.sub = sub;
    }
    public String getMsg() {
        return msg;
    }
    public void setMsg(String msg) {
        this.msg = msg;
    }
    public String getContact() {
        return contact;
    }
    public void setContact(String contact) {
        this.contact = contact;
    }

    String re;

    public String execute() throws Exception
    {
        System.out.println("Send FeedBack");
        try
        {
                addActionMessage("Your FeedBack is Send Successfully");

                String from = "abc@gmail.com";
                String to = "info@shreerajinvestment.com";

                String subject = sub;
                String text = "This Mail from http://www.shreerajinvestment.com/ \n\nThis FeedBack From : \n\n \t\t Sender Name :" + name + "\n\n\t\t Sender Email ID :" + email1 + "\n\n\t\t Sender Contact No. :" + contact + "\n\n\t\t" + msg;
                String password = "my password";

                SendMail SendMail = new SendMail(from, to, subject, text, password);
                SendMail.send();

                re=SUCCESS;
        }
        catch(Exception ex)
        {
            System.out.println("Connection Failed: "+ex);
            ex.printStackTrace();
        }
        return re;
    }
}
  • 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-11T14:37:27+00:00Added an answer on June 11, 2026 at 2:37 pm

    if you hit the UnknownHostException: smtp.gmail.com, try ping smtp.gmail.com and make sure you got a response (able to access). Often times, your connection may block by your firewall or proxy behind.Otherwise you need javaee.jar and mail.jar into your classpath.
    Cheers…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using struts 2.3.7, struts2-jquery-grid-plugin-3.5.0 and hibernate 3.6. I want to reload the
I am using http://www.mkyong.com/struts2/struts-2-hibernate-integration-with-full-hibernate-plugin/ as my refernce for struts+hibernate.I need to replace return session.createQuery(from
I have a web application that using Struts + Spring + Hibernate . In
I'm using Hibernate with Struts. I want to copy data of one table to
I have an application that built using struts, spring, hibernate. In this application, i
I am using netbeans, and want to integrate struts and hibernate for a simple
I am running an application that used struts and hibernate. I am currently using
I'm writing a website in JSP using Struts and Hibernate. I'm looking for a
I'm trying to make a project using struts 2, spring 3 and hibernate, but
I am using hibernate 3.2 with struts 1.2 framework here is the details of

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.