Skip to Content
0
Former Member
Dec 28, 2005 at 10:46 AM

Problem in the source code...java mail

16 Views

Dear all

Could anyone pl tell me what inputs required in the below mentioned code...

-


public void send_mail ()

{

try{

// Set the host smtp address

Properties props = new Properties();

//put the smtp server here

props.put("mail.smtp.host","105.97.14.72");

// create some properties and get the default Session

Session session = Session.getDefaultInstance(props,null);

// create a message

Message msg = new MimeMessage(session);

// set the from and to address

InternetAddress addressFrom;

if (email_from.equals("") )

{

addressFrom = new InternetAddress("anonymous");

}

else

{

addressFrom = new InternetAddress(email_from);

}

msg.setFrom(addressFrom);

InternetAddress addressTo = new InternetAddress("pvpreddy@abccompany.com");

msg.setRecipient(Message.RecipientType.TO,addressTo);

msg.setSubject("Portal Feedback");

msg.setContent(txtdescr, "text/html");

msg.setSentDate(new GregorianCalendar().getTime());

Transport.send(msg);

} catch (Exception E){

state = ERROR_STATE;

error_messg = "Error sending mail:";

error_messg = error_messg.concat(E.getMessage());

}

}

}

-


when i click the send button ..it says error sending mail:smtp

suggest me

rgds

pradeep