Foros de discusión

Problem with from address in mail in liferay

krishna mohan mathakala, modificado hace 10 años.

Problem with from address in mail in liferay

New Member Mensajes: 20 Fecha de incorporación: 31/01/13 Mensajes recientes
Hi ,
I am working with liferay 6.0.6. I am using gmail smtp server to send emails from liferay .
In mail configuration I used a gmai Id ="abc@gmail.com".
I want to set from address = "xyz@yahoo.com".

While preparing email , even though I set from address as " xyz@yahoo.com ", by using InternetAddress fromAddress = new InternetAddress("xyz@yahoo.com");
but the mail is showing from address of " abc@gmail.com".
How can i resove this .?
thumbnail
sushil patidar, modificado hace 10 años.

RE: Problem with from address in mail in liferay

Expert Mensajes: 467 Fecha de incorporación: 31/10/11 Mensajes recientes
Hi,
Can you please make it more clear? .Please mention the lines of code you are using to understand the problem properly.


Thanks
krishna mohan mathakala, modificado hace 10 años.

RE: Problem with from address in mail in liferay

New Member Mensajes: 20 Fecha de incorporación: 31/01/13 Mensajes recientes
Hi sushil patidar ,
In my mail configuration while configuring gmail smtp mail serverI used my gmail id(krishna@gmail.com) .
My method has following code .

InternetAddress fromAddress = new InternetAddress("admin@krishnaorg.com");
InternetAddress toAddress = new InternetAddress(emailIdsArray[count]);
MailMessage mailMessage = new MailMessage(
fromAddress,toAddress , subject ,mailBody , true);
MailServiceUtil.sendEmail(mailMessage);


When i send a mail. The mail have from address "krishna@gmail.com", but I want from address to be " admin@krishnaorg.com ".

How can I achieve this??
thumbnail
meera prince, modificado hace 10 años.

RE: Problem with from address in mail in liferay

Liferay Legend Mensajes: 1111 Fecha de incorporación: 8/02/11 Mensajes recientes
HI

Use following code and try it may work


com.liferay.util.mail.MailEngine.send(InternetAddress from, InternetAddress to, String subject,String body, boolean htmlFormat);

if its bulk mail sending then use following method

com.liferay.util.mail.MailEngine.send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc,String subject, String body, boolean htmlFormat);

InternetAddress[] cc for you can pass null if you don't have cc addresses
krishna mohan mathakala, modificado hace 10 años.

RE: Problem with from address in mail in liferay

New Member Mensajes: 20 Fecha de incorporación: 31/01/13 Mensajes recientes
This is also not working
karthik reddy, modificado hace 10 años.

RE: Problem with from address in mail in liferay

Junior Member Mensajes: 60 Fecha de incorporación: 8/04/13 Mensajes recientes
Mail Sending in LiferayHi try this link