We're using javax.mail in our code to send emails and we're also having a custom osgi config to store host, port, etc...
com.company.config.CompanyEmailService.cfg.json
{
"mail.smtp.host":"$[env:AEM_PROXY_HOST;default=proxy.tunnel]",
"mail.smtp.port":"30002",
.
.
}
How we can "make" aem to transform from this $[env:AEM_PROXY_HOST;default=proxy.tunnel] to something that we defined under advanced networking configuration.
{
"name": "smtp.gmail.com",
"portDest": 465,
"portOrig": 30002
}
When mail.smtp.host is read from our custom config it stays unchanged and mail can't be send because it's using this string as is as a server name, $[env:AEM_PROXY_HOST;default=proxy.tunnel],
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
We managed to resolved the issue by using System.getenv("AEM_PROXY_HOST") in our code.
Hi @nbg62
SMTP configuration can be done as below example
{
"debug.email": false,
"smtp.user": "$[secret:smtpuser]",
"smtp.password": "$[secret:smtppassword]",
"smtp.port": 465,
"smtp.ssl": true,
"smtp.starttls": true,
"smtp.host": "in.mailjet.com",
"from.address": "XXXXXXXXXX"
}
And also you can refer to below URL as well
I understand that on Aem Cloud, port forwarding is required and $[env:AEM_PROXY_HOST;default=proxy.tunnel] needs to be used as stated in the URL that you shared ?
@nbg62 It is not necessarly needed to every time use $[env:AEM_PROXY_HOST;default=proxy.tunnel] syntax. Still the old way of implementation on-prem works.
This will be used only when we have 2 environment with same runmode. for ex: Dev and QA
In cloud dev and qa both are considered as dev environments so we can not have 2 different configurations. So it is recommanded to use $[env:AEM_PROXY_HOST;default=proxy.tunnel] way of implementation
Thanks Jagadeesh,
I don't follow you on this, "This will be used only when we have 2 environment with same runmode. for ex: Dev and QA", I can distinguish every config/env, like config.author.dev, config.author.stage, etc...
Can you tell how's $[env:AEM_PROXY_HOST;default=proxy.tunnel] mapped internally ?
We managed to resolved the issue by using System.getenv("AEM_PROXY_HOST") in our code.
Views
Likes
Replies