Can i configure two Email Service providers in one AEM instance.? | Community
Skip to main content
Level 4
May 10, 2016
Solved

Can i configure two Email Service providers in one AEM instance.?

  • May 10, 2016
  • 2 replies
  • 1697 views

Is there any possibility to configure two Email Service providers in one AEM instance.? Am planning to use a AEM as multi tenant, where the each website is having their own email servers.

Thanks,

KK

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

where the each website is having their own email servers

WHen configuring email on AEM out of the box - you have this configuration screen: 

As you can see - there is only fields for: 

  • SMTP server host name - the SMTP server that you want to use.
  • SMTP server port - the server port to use, Typically this value is 25. 
  • Username - the user name for the SMTP user. 
  • Password - the corresponding password.

 

Therefore - there is no option for a 2nd configuration. All AEM sites that use email and MessageServicGateway will use this 1 configuration. 

 

Now if you really want to have each site on 1 instance use its own mail server - you can code a custom email service that uses the Java MAIL API. Then you can code the configurations in Java. That way - 1 site can invoke customEmailService1 and site2 can invoke customEmailService2. 

 

For example - in Java: 

 Properties properties = System.getProperties();
 
        // Setup mail server (Depending upon your
        // Mail server - you may need more props here
        properties.setProperty("mail.smtp.host", aHost);
        properties.setProperty("mail.smtp.user", "<valid SMTP user>");

This 1-1 way does not use ootb AEM email cofiguration

2 replies

smacdonald2008
smacdonald2008Accepted solution
Level 10
May 10, 2016

where the each website is having their own email servers

WHen configuring email on AEM out of the box - you have this configuration screen: 

As you can see - there is only fields for: 

  • SMTP server host name - the SMTP server that you want to use.
  • SMTP server port - the server port to use, Typically this value is 25. 
  • Username - the user name for the SMTP user. 
  • Password - the corresponding password.

 

Therefore - there is no option for a 2nd configuration. All AEM sites that use email and MessageServicGateway will use this 1 configuration. 

 

Now if you really want to have each site on 1 instance use its own mail server - you can code a custom email service that uses the Java MAIL API. Then you can code the configurations in Java. That way - 1 site can invoke customEmailService1 and site2 can invoke customEmailService2. 

 

For example - in Java: 

 Properties properties = System.getProperties();
 
        // Setup mail server (Depending upon your
        // Mail server - you may need more props here
        properties.setProperty("mail.smtp.host", aHost);
        properties.setProperty("mail.smtp.user", "<valid SMTP user>");

This 1-1 way does not use ootb AEM email cofiguration

Tuhin_Ghosh
Level 8
May 10, 2016

I think this should answer your query.

Thanks

Tuhin