Hi ,

I'm trying to send email but it's throwing error :

can anyone help me?

Hi,


do you have been the correct configuration on service center side?


please, look to this document:

https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/Configure_OutSystems_to_Send_Emails

Regards,

Nuno Verdasca 

Nuno Miguel Verdasca wrote:

Hi,


do you have been the correct configuration on service center side?


please, look to this document:

https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/Configure_OutSystems_to_Send_Emails

Regards,

Nuno Verdasca 

Hi Nuno Verdasca,

I do have correct configuration similar to what is mentioned in the document 

Gandeev b wrote:

Hi ,

I'm trying to send email but it's throwing error :

can anyone help me?


Hi Gandeev

We resolved our issue by passing variables rather than using functions ( getuserid().).  Seems like the email doesn't really have access to the functions, although you are able to successfully use them in expressions when creating the email content.

hope it helps

regards

Seema

As already suggested this error suggests there is problem with your email configuration in Service Centre. 

Has it ever worked/was it working and has now stopped working?

Sam Long wrote:

As already suggested this error suggests there is problem with your email configuration in Service Centre. 

Has it ever worked/was it working and has now stopped working?

This is the first time i'm trying email functionality 


Hello Gandeev,

By the message: "Error creating Email", I would say that you have a problem in your email screen.
I would put a breakpoint at the beginning of the preparation of the e-mail page. Then I would try to send an email with debugger started and see what is happening.

Remember that your application does not send the e-mail. There is a service in the platform server that forwards all mails after fetching them from the e-mail queue. Because of this, the e-mail screen request is in a separated session. Session variables will not have the values of the user session that is sending the mail, and the GetUserId() will return 0. If you depend on this to find data, and if you are using any Get<entity>() method in your e-mail screen preparation or canvas, that depend on something in a session variable or GetuserId(), it will throw an exception.

In those cases, you need to pass the information through input parameters on the e-mail screen.

I hope this can help.

Cheers.

Seema Pandey wrote:

Gandeev b wrote:

Hi ,

I'm trying to send email but it's throwing error :

can anyone help me?


Hi Gandeev

We resolved our issue by passing variables rather than using functions ( getuserid().).  Seems like the email doesn't really have access to the functions, although you are able to successfully use them in expressions when creating the email content.

hope it helps

regards

Seema

Hi Seema 

Could you please let me know what variables you are passing?

Eduardo Jauch wrote:

Hello Gandeev,

By the message: "Error creating Email", I would say that you have a problem in your email screen.
I would put a breakpoint at the beginning of the preparation of the e-mail page. Then I would try to send an email with debugger started and see what is happening.

Remember that your application does not send the e-mail. There is a service in the platform server that forwards all mails after fetching them from the e-mail queue. Because of this, the e-mail screen request is in a separated session. Session variables will not have the values of the user session that is sending the mail, and the GetUserId() will return 0. If you depend on this to find data, and if you are using any Get<entity>() method in your e-mail screen preparation or canvas, that depend on something in a session variable or GetuserId(), it will throw an exception.

In those cases, you need to pass the information through input parameters on the e-mail screen.

I hope this can help.

Cheers.

Hi Eduardo Jauch,


I'm not using user sessions for sending mails as my requirement was to get all users who have admin role and send mail to them so i'm using users ,role and user-role tables to get users email id.


Thanks 

Gandeev


It was not what I meant to say, Gandeev.

If in the e-mail screen (the one you use to create the mail template) you use session variables or GetUserId(), for example, they will not have the expected values.

In this specific screen (the e-mail template screen), if you are using GetYourEntity entity action, for example, and using invalid ID's, it will throw an exception.

So, just put a breakpoint in the e-mail template screen preparation, and debug it when the email is being prepared, so you can check if the internal error is from the e-mail template.

Just because the error message states that the error happening when "creating" the mail, not when sending it.

Cheers.

Eduardo Jauch wrote:

It was not what I meant to say, Gandeev.

If in the e-mail screen (the one you use to create the mail template) you use session variables or GetUserId(), for example, they will not have the expected values.

In this specific screen (the e-mail template screen), if you are using GetYourEntity entity action, for example, and using invalid ID's, it will throw an exception.

So, just put a breakpoint in the e-mail template screen preparation, and debug it when the email is being prepared, so you can check if the internal error is from the e-mail template.

Just because the error message states that the error happening when "creating" the mail, not when sending it.

Cheers.

Hi Eduardo Jauch,

You are right ..! I debugged the solution and its one specific entity which is null due to that i was getting that error.

Thank you for you input :)

but unfortunately now after correcting that i'm getting some other error:

could you please help me here ?


Hi Gandeev, are you trying to send emails using g-suite or gmail, as I think (from memory) the configuration differs.


Sam


Sam Long wrote:

Hi Gandeev, are you trying to send emails using g-suite or gmail, as I think (from memory) the configuration differs.


Sam


Hi Sam,

Yes, I'm using Gmail to send emails


Hi Gandeev,

I send mails to gmail without any problem.

The problem is not the destinatary, is the "sender", so, the SMTP server you are using.
If you use a GMAIL SMTP server to send the mail, than you have to configure it properly, according to the link you already saw and, maybe, requiring extra configuration, like you did, to enable OutSystems to use it to send emails.



Otherwise, check this post: email sent by personal environment is not working fine

This discussion helped. After clicking Display unlock Captcha the previous pending mails are also flowing in my inbox.


Cheers,

Nuno Verdasca


Hi Gandeev


I just set up sending emails using gmail smtp from my outsystems personal environment.

The following worked for me

SMTP: smtp.gmail.com

Port: 587

USername: my gmail email address

Password: I had to create an app password in gmail rather than use my usual email password. The following article explains how to create an app password in gmail. https://www.lifewire.com/get-a-password-to-access-gmail-by-pop-imap-2-1171882

I then saved the email settings and republished my app/espace.

Hi Gandeev,

First, if you are setting the "FROM" in the mail, and it is not the same mail as the account you are using the smtp, you need to configure it as a permitted sender in your gmail account.

Also, try to change the smtp server to smtp.googlemail.com. 

If this alone does not do the trick, try this (from here):

Have you allowed for less secure apps?  Please do so, and see if that helps.  https://myaccount.google.com/lesssecureapps  You may also need to clear a "captcha".  (You usually have only a 10 minute window after clearing the captcha, depending on what you are doing).https://accounts.google.com/DisplayUnlockCaptcha If using 2 Step Verification in Gmail, you may need an application  password. https://support.google.com/accounts/answer/185833?hl=en   Use "recent" mode if you are using POP3 on multiple devices.  https://support.google.com/mail/answer/7104828?hl=en 

Hope this helps.