Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
sandeep tripathi
need help in web form
20. September 2012 09:20
Antwort

sandeep tripathi

Rang: Regular Member

Nachrichten: 100

Eintrittsdatum: 19. Oktober 2011

Neue Beiträge

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
20. September 2012 09:42
Antwort

Vitaliy Koshelenko

Rang: Regular Member

Nachrichten: 219

Eintrittsdatum: 25. März 2011

Neue Beiträge

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
21. September 2012 03:20
Antwort

sandeep tripathi

Rang: Regular Member

Nachrichten: 100

Eintrittsdatum: 19. Oktober 2011

Neue Beiträge

Hi Vitaliy ,

thanks it is working for me too.
sandeep tripathi
RE: need help in web form
7. November 2012 23:07
Antwort

sandeep tripathi

Rang: Regular Member

Nachrichten: 100

Eintrittsdatum: 19. Oktober 2011

Neue Beiträge

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