Expand my Community achievements bar.

Where to add portForwards rule for Advanced networking

Avatar

Level 4

Hello All,

 

We are using DAY CQ Mail service to send mail using SMTP server. But in cloud manager it requires to configure portForwards for AEM instance to use advance networking. 

I am not sure where to configure port forward rule? Does it require OSGI config changes as below:

"portForwards": [{
"name": "smtp.mymail.com",
"portDest": 465,
"portOrig": 30465
}]
...

or we need to use cloud manger API https://developer.adobe.com/experience-cloud/cloud-manager/reference/api/ for this?

5 Replies

Avatar

Community Advisor

Hello @supriya-hande 

 

Please refer to the documentation on https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/networking/flexible-p... 

 

You can either use Curl Or use Postman to submit the request

 

Prior to this you would have to enable Cloud manager project in Developer Console. It is explained in the "Prerequisite" section of same document https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/networking/flexible-p...


Aanchal Sikka

Avatar

Level 4

Hi @aanchal-sikka 

Thanks for your input. I have configured port forward using below command:
$ curl -X PUT https://cloudmanager.adobe.io/api/program/{programId}/environment/{environmentId}/advancedNetworking \
-H 'x-gw-ims-org-id: <ORGANIZATION_ID>' \
-H 'x-api-key: <CLIENT_ID>' \
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
-H 'Content-Type: application/json' \
-d @./flexible-port-egress.json
I have created project in could manager API and I got org id, client id and token values. Added below config inside flexible-port-egress.json file(this is local system file)
{
"portForwards": [
{
"name": "smtp.office365.com",
"portDest": 111,
"portOrig": 30111
}
]
}
portDest and portOrig are the sample values not actual. I am getting AEM instance info after running above command.
But when I am testing workflow I am still getting same error: org.apache.commons.mail.EmailException: javax.mail.internet.AddressException: Local address contains illegal character in string ``$[env:EMAIL_USERNAME]''
This is my OSGI config:

{
"smtp.host" : "$[env:AEM_PROXY_HOST;default=proxy.tunnel]",
"smtp.port": 30587,
"smtp.user": "$[env:EMAIL_USERNAME]",
"smtp.password" : "$[secret:EMAIL_PASSWORD]",
"smtp.ssl": false,
"smtp.starttls" : true
}


I am not sure why this is happening. Any idea why this is happening.

Avatar

Administrator

@supriya-hande  Did you find the suggestion from @aanchal-sikka helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni

Avatar

Level 4

@kautuk_sahni 
I didnt hear back from @aanchal-sikka 

I have enabled advanced networking for dev server but still I am getting below error:
org.apache.commons.mail.EmailException: javax.mail.internet.AddressException: Local address contains illegal character in string ``$[env:EMAIL_USERNAME]''

Day CQ Mail service OSGI config is having this "smtp.user""$[env:EMAIL_USERNAME]",
I am trying to get value of smtp.user in java code. Its failing while substituting values from OSGI configs. Any idea why this is happening?

Avatar

Level 4

@aanchal-sikka Could you please help here why this error is coming while reading values from env vars.
org.apache.commons.mail.EmailException: javax.mail.internet.AddressException: Local address contains illegal character in string ``$[env:EMAIL_USERNAME]''