Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
sandeep tripathi
need help in web form
September 20, 2012 9:20 AM
Answer

sandeep tripathi

Rank: Regular Member

Posts: 100

Join Date: October 19, 2011

Recent Posts

Hi All,

i am trying to create registration from using web form but i am not able to get 2 think
1) how can i use date in web form .
2) how can i confirm email setting .

i had saw email setting for gmail and i had added the given setting in my root.xml in conf/catalina/localhost
but it give error failed to connect valid smtp server please make sure it is properly configured could not connect smtp host
Vitaliy Koshelenko
RE: need help in web form
September 20, 2012 9:42 AM
Answer

Vitaliy Koshelenko

Rank: Regular Member

Posts: 222

Join Date: March 25, 2011

Recent Posts

Hi!
For email configuration go to CP -> Server Administration -> Mail and configure following settings:

pop.gmail.com
995

checked radio button

{you gmail account}
{you gmail password}

smtp.gmail.com
465

checked radio button

{you gmail account}
{you gmail password}

They are working for me.
sandeep tripathi
RE: need help in web form
September 21, 2012 3:20 AM
Answer

sandeep tripathi

Rank: Regular Member

Posts: 100

Join Date: October 19, 2011

Recent Posts

Hi Vitaliy ,

thanks it is working for me too.
sandeep tripathi
RE: need help in web form
November 7, 2012 11:07 PM
Answer

sandeep tripathi

Rank: Regular Member

Posts: 100

Join Date: October 19, 2011

Recent Posts

hi Everyone,

need help in functionality of sending mail ,in liferay we have to specify username and pass word my client do not want to use that ,so i had remove all the setting ,we have a mail server which we can use so i try code for sendinfg mail in my portlet but it will be exception
javax.mail.messageexception could not connect to smtp host :smtp.gmail.com port :25 and connect time out

System.out.println("data inserted in taptrackmail ");

Properties props = new Properties();
props.put("mail.smtp.host", host);
props.put("mail.smtp.auth", "false");
props.put("mail.debug", "false");
props.put("mail.smtp.ssl.enable", "true");

// Get session
Session session = Session.getInstance(props);
try {
// Instantiate a message
Message msg = new MimeMessage(session);
// Set the FROM message
msg.setFrom(new InternetAddress(email));
// The recipients can be more than one so we use an array but you can
// use 'new InternetAddress(to)' for only one address.
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
// Set the message subject and date we sent it.
msg.setSubject(subject);

// Set message content
MimeBodyPart messageBodyPart = new MimeBodyPart();
MimeBodyPart messageBody = new MimeBodyPart();
messageBody.setContent(text, "text/html");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBody);
multipart.addBodyPart(messageBodyPart);

msg.setContent(multipart);

Transport transport = session.getTransport("smtp");
// Send the message
transport.connect();
transport.sendMessage(msg, address);

transport.close();
//Transport.send(msg);
System.out.println("mail send");
}
catch (Exception e ) {
System.out.println("exception+++++"+e);
}

can some one help me out what i am doing wrong !!!

Thanks and Regards
Sandeep