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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:22:24+00:00 2026-06-16T11:22:24+00:00

I have to develop one java application. Here i got the below error: The

  • 0

I have to develop one java application.

Here i got the below error:

The method setText(String) in the type Part is not applicable for the arguments (String, String)

Here i have to send the retrievedUserName,retrievedPassword to my mail via settext.
How can i call the above 2 string value in settext method.please help me.whats wrong in my code.

This is my code:

      public class SendMail {
      public String authentication(String Product,String Cost){
      String retrievedUserName = "";
      String retrievedPassword = "";
      String retrievedEmail = "";
      String status = "";
      try{
      Class.forName("com.mysql.jdbc.Driver");
      Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/xcart-432pro","root","");

      PreparedStatement statement =  con.prepareStatement("SELECT xcart_products.product,xcart_products.list_price,xcart_customers.email FROM xcart_products,xcart_customers WHERE product = '"+Product+"'");
      ResultSet result = statement.executeQuery();
      while(result.next()){
       retrievedUserName = result.getString("list_price");
       retrievedPassword = result.getString("product");
       retrievedEmail = result.getString("email");
            }
          if(retrievedPassword.equals(Product)){
       status = "The product name is send to your email";
        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() {
                        new PasswordAuthentication("xxxxx@gmail.com","4242vfgDF!");
                        }
                    });
                   try {

            Message message = new MimeMessage(session);
             message.setFrom(new InternetAddress("krishnaveni.veeman@gmail.com"));
         message.setRecipients(Message.RecipientType.TO,
                    InternetAddress.parse("demo@gamil.com"));
            message.setSubject("Testing Subject");
            message.setText("Dear Friends This is your product name and price"+
                    retrievedPassword,retrievedUserName);

        Transport.send(message);

            System.out.println("Done");

            } 
  • 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-16T11:22:27+00:00Added an answer on June 16, 2026 at 11:22 am

    Try specifying the charset. I also use setContent, but I suppose setText would work the same way. Try replacing your setText call with this:

     message.setContent("Dear Friends This is your product name and price "+
                         retrievedPassword+retrievedUserName, "text/html; charset=utf-8");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to develop a web application in Java, a pretty big one with
I am trying to develop one simple application using Java, Flex and Blazeds. I
I have to develop one android application.The app is performs retrieve data from mysql
We have a java assignment where in we're supposed to develop a method that
We recently started using Eclipse to develop our java application and have been running
I need to develop the HTTPS application using Flex and Java. But i have
I'm new to iPhone development,currently i have to develop my application as dynamic one,Where
I have develop one web site in php. I know how to upload it
Hi i have develop and deploy one multilingual (english uk and swedish) website at
I have to develop a application (Winforms-application) which is connected to a database within

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.