掲示板

email notification

12年前 に Akriti Agrawal によって更新されました。

email notification

New Member 投稿: 21 参加年月日: 11/04/21 最新の投稿
Hi, i m using liferay 6.0.5 i'm unable to locate "com.liferay.util.mail.MailEngine" class please help me out.


Thanks :-)
thumbnail
12年前 に Nilesh Gundecha によって更新されました。

RE: email notification

Regular Member 投稿: 205 参加年月日: 09/12/01 最新の投稿
Hi Akriti,

MailEngine.class file exists inside the util-java.jar file. I didnt get exactly what do you mean by "unable to locate".

Regards,
Nilesh.
12年前 に Akriti Agrawal によって更新されました。

RE: email notification

New Member 投稿: 21 参加年月日: 11/04/21 最新の投稿
thanks for the reply.

actualy i have to generate an automatic email on publish of any news.
step1: so i wrote code (given below) in root.xml file

<Resource
name="mail/MailSession"
auth="Container"
type="javax.mail.Session"
mail.imap.host="localhost"
mail.pop.host="localhost"
mail.store.protocol="imap"
mail.transport.protocol="smtp"
mail.smtp.host="smtp.gmail.com"
mail.smtp.port="465"
mail.smtp.auth="true"
mail.smtp.starttls.enable="true"
mail.smtp.user="your_user_id"
password="your_password"
mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory"
/>
step 2. Class com.liferay.util.mail.MailEngine has send method, which is overrided with a few arguments
and have to write code in it
String from = "sender@host.com";
String to = "recipient@host.com";
String subject="This is email title";
String body="Hello World, this is my first email";
MailEngine.send(from, to, subject, body);
thats why i m searching this class.

this code i have got from this link: http://portaldevelopment.wordpress.com/2008/06/16/sending-email-in-liferay-portal/
thumbnail
1年前 に Tanweer Ahmed . によって更新されました。

RE: email notification

Expert 投稿: 322 参加年月日: 10/03/11 最新の投稿
Hi Akriti,

Use the code below to send a mail,


                                        String subject = "Test Mail";
                                        String body = "This is a test mail"
                                        InternetAddress from = new InternetAddress(fromAddress,fromName);
                                        InternetAddress to = new InternetAddress(toAddress,"unknown");
                                        MailMessage message = new MailMessage(from, to, subject, body, true);
                                        MailServiceUtil.sendEmail(message);


Also don't forget to configure the mail configuration in portal-ext.properties.
Hope this helps.

Regards,
Tanweer Ahmed Ansari,
mPowerian-BoschLer
12年前 に Akriti Agrawal によって更新されました。

RE: email notification

New Member 投稿: 21 参加年月日: 11/04/21 最新の投稿
thanks for the reply...
The code given is to be written in root.xml file?
How will i configure the mail configuration in portal-ext.properties and where will i find this portal-ext.properties.
thumbnail
12年前 に Nilesh Gundecha によって更新されました。

RE: email notification

Regular Member 投稿: 205 参加年月日: 09/12/01 最新の投稿
You can not write the java code inside XML file, right?? So the code given by Tanveer should not be written in ROOT.xml file.

The code what he gave has to be written in the java file from where the mail has to be triggered (sent). And you can find the portal-ext.properties file inside the Root\WEB-INF\classes\. And if you dont find it there then you need to create on file with name as "portal-ext.properties" in the same directory location.

And paste the below content with right values inside that file: -

    mail.session.mail.pop3.host=localhost
    mail.session.mail.pop3.password=
    mail.session.mail.pop3.port=110
    mail.session.mail.pop3.user=
    mail.session.mail.smtp.auth=false
    mail.session.mail.smtp.host=localhost
    mail.session.mail.smtp.password=
    mail.session.mail.smtp.port=25
    mail.session.mail.smtp.user=
    mail.session.mail.store.protocol=pop3
    mail.session.mail.transport.protocol=smtp


Hope this helps.

Regards,
Nilesh.
thumbnail
1年前 に Tanweer Ahmed . によって更新されました。

RE: email notification

Expert 投稿: 322 参加年月日: 10/03/11 最新の投稿
Akriti Agrawal:
thanks for the reply...
The code given is to be written in root.xml file?
How will i configure the mail configuration in portal-ext.properties and where will i find this portal-ext.properties.


Hi Akriti,

The code I gave should go in Java from where you want to send the mail.
The code that Nilesh shared is the mail configuration that should go inside portal-ext.properties.
Hope this helps.

Regards,
Tanweer Ahmed Ansari,
mPowerian-BoschLer
thumbnail
12年前 に Rohit Salecha によって更新されました。

RE: email notification

Junior Member 投稿: 50 参加年月日: 11/02/21 最新の投稿
When a girl asks questions many guys reply but its never the other way round emoticon

http://liferaydemystified.blogspot.com
12年前 に Akriti Agrawal によって更新されました。

RE: email notification

New Member 投稿: 21 参加年月日: 11/04/21 最新の投稿
I've made some changes in portal.properties file and set-up an smtp server so its working fine now


Thanks everyone :-)
thumbnail
12年前 に Raju OO7 によって更新されました。

RE: email notification

Regular Member 投稿: 239 参加年月日: 10/04/27 最新の投稿
Rohit Salecha:
When a girl asks questions many guys reply but its never the other way round emoticon

http://liferaydemystified.blogspot.com


Nice comment.. I like it!!... emoticon
thumbnail
12年前 に Vasily N. Kharitonov によって更新されました。

RE: email notification

New Member 投稿: 19 参加年月日: 09/12/30 最新の投稿
Do any body khows how to use portal settings connection? I meen connection that admin can do through control panel of Liferay. Mail data can be changed some times. I dont want to rewrite portal-ext and restart portal.
Thanks!
12年前 に Akriti Agrawal によって更新されました。

RE: email notification

New Member 投稿: 21 参加年月日: 11/04/21 最新の投稿
Hi,

You can change the connection setting by choosing control panel>server administration>mail

assign the values

Incoming pop server as pop.gmail.com
Incoming port 995
user name : a valid email id
password :password of the email id specified above
check use secure connection

Outgoing smtp server smtp.gmail.com
port 465

user name : a valid email id
password :password of the email id specified above