Email From property gets overridden

Hello,

I am using an Email widget in my action flow. I specify the 'From' property to be the person logged into the app. For some reason, when I get the email, the 'From' is the email address, used as the Username in the Email Configuration page, in Service Center, which is even different from the Default Sender Email. The name in front "name <name@xxx.com> is right, but the address gets changed in the background. Why is this happening?




Hi Mark,

Have a look at the following documentation about sending email from web applications.

How OutSystems Handles the Email Sending

At runtime, the Send Email tool renders the email content, adds it to a sending queue, and continues execution, thus not sending it right away. It is another OutSystems process, the OutSystems Scheduler Service, that picks queued emails and effectively sends them, i.e. emails are asynchronously sent by OutSystems.

As emails are sent asynchronously in a different session you cannot rely in session data to render emails.

OutSystems tries to send failed emails for a period of days (default period is 2 days). When an email continues to fail after this period, OutSystems quits trying to send it.

All emails you send through an OutSystems web application are logged and you are allowed to check up on them in Service Center.


I have underlined the important part about the fact that emails are sent asynchronously in a different session and so the platform cannot rely on session data to render emails. 

Since you try to use the logged in person's emailaddres, it looks like this is the reason your 'From' property turns empty (you should be able to Debug this) and therefore the Default Sender Email from your Email Configuration in Service Center is being used instead.

Hope this helps!

Regards,

Nordin

Thank you, Nordin, for your reply. 

As I stated in my first, message, the default email is not being used and the 'name' part is working. And, I am not using session data for the From. I am building the From property, from a database table (see the screen shot that I attached in my first message), the same as the 'To' property. The 'To' property is working perfectly. There must be something else going on, otherwise the 'From' would never work for anybody. Please read my whole explanation and look at the screen shot, in my first message. The email address for the 'From' property, is being built from the GetManagerEmail aggregate right before the EmailSendMOU email widget. What am I doing wrong or what setting do I need to adjust? Please help!!!

Thanks,

Mark

Hi!

Have you confirmed that this:

actually contains the Email you want to show up in 'From'?

Place a breakpoint on Email and check if the Aggregate GetManagerEmail actually has that Email address in the Current possition. 

If you can please post a screenshot of this aggregate's output).

Thanks for replying, Filipe!

Yes, I did confirm this using debugger, before. But, as you requested, here is the evidence. :) FYI...the name, in front of the address comes out just fine.Thanks for your assistance!!

It comes out in the email as...


and it is not using my default email, it is using the email from the username...


any help will be greatly appreciated!!!

Thanks.

Well it looks like you're doing it right, maybe it's a configuration on the SMTP server?

I'm not well versed on this beyond using Email Send, I don't know what else to suggest...

Good luck

Filipe Silva wrote:

Well it looks like you're doing it right, maybe it's a configuration on the SMTP server?

I'm not well versed on this beyond using Email Send, I don't know what else to suggest...

Good luck

Thanks Filipe!! I appreciate you looking into it. I hope someone has the answer.


Hi Mark,

First of all, sorry for misunderstandig the issue. This is really unexpected behaviour and I am not sure what's causing this.

Can you try to eliminate the use of the EmailAddressCreate built-in function and only use an emailaddress as a value in the 'From' property? I want to make sure it hasn't anything to do with this function.

So instead of 'name <name@xxx.com>' populate the MOUEmailFrom local variable with 'name@xxx.com'. Or just enter a hardcoded emailaddress directly in the 'From' property of the SendEmail widget to see if it will send the email correctly. 

I'll wait for the results.

Regards,

Nordin

One more test that comes to mind.

If you leave the 'From' property of the SendEmail widget empty, does the email then contain the Default Sender Name and Default Sender Email properties of the Email Configuration?

It seems like it has to do something with either the EmailAddressCreate built-in function or, like Filipe Silva hints at, some configuration of the SMTP server. Maybe it does not allow to change the Sender Email address.

Have a look at this post: https://www.outsystems.com/forums/discussion/29337/overriding-email-sender-name/

The last post shows a similar issue like yours, but the issue was never identified. 

I will do some more digging.


Solution

Hi Mark,

The following post confirms our suspicion:

https://www.outsystems.com/forums/discussion/51185/how-to-change-sender-email/

It is the SMTP server that is not allowing you to change the sender emailaddress. Please look into that, since this not an OutSystems related issue.

Regards,

Nordin

Solution

You can check the emails in the Service Center if the mail is executing properly or not. and also can able to get the exact error message. That will help you to solve the issues.


Thank you,

Sudip

Nordin Ahdi wrote:

Hi Mark,

The following post confirms our suspicion:

https://www.outsystems.com/forums/discussion/51185/how-to-change-sender-email/

It is the SMTP server that is not allowing you to change the sender emailaddress. Please look into that, since this not an OutSystems related issue.

Regards,

Nordin

This seems to be the solution to your problem :)


Thank you, everyone, for your help on this issue. 

We use Gmail, so the "how to change sender email" post was the answer.  The two different terms is why I didn't find this post, on my own. I was looking for "From" not "Sender".

Thank you Nordin for really digging into this. I really appreciate it!!


Blessings to you all,

Mark

Don’t sweat it Mark, we’re here to help :).

I’m glad you were able to fix it!

Regards,

Nordin