This topic is locked
[SOLVED]

 SMTP Settings - Read From Database

4/20/2020 1:24:15 PM
ASPRunner.NET General questions
F
francg author

Hello,
First at all, thank for this great tool.
I having problem using the custom SMTP settings....
I put these fix values in After Application Init (Of couse using my real password and real user)
(This fix values in future I will take from a email setup table in database)
GlobalVars.globalSettings.InitAndSetArrayItem(false, "useBuiltInMailer");

GlobalVars.globalSettings.InitAndSetArrayItem(true, "useCustomSMTPSettings");

GlobalVars.globalSettings.InitAndSetArrayItem("smtp.office365.com", "strSMTPServer");

GlobalVars.globalSettings.InitAndSetArrayItem("myemail@domain.es", "strFromEmail");

GlobalVars.globalSettings.InitAndSetArrayItem("myemail@domain.es", "strSMTPUser");

GlobalVars.globalSettings.InitAndSetArrayItem("password", "strSMTPPassword");

GlobalVars.globalSettings.InitAndSetArrayItem("587", "strSMTPPort");

GlobalVars.globalSettings.InitAndSetArrayItem("tls", "SMTPSecure");
And its not working, What I am doing wrong?
If I put same data in built in email setup works perfect.
Thank you....

Sergey Kornilov admin 4/20/2020

It should work.
What version of ASPRunner.NET do you use?

If you hardcode those settings in the ASPRunner.NET itself - does it work?
Also, what exactly happens when you applying this code?

F
francg author 4/21/2020



It should work.
What version of ASPRunner.NET do you use?

If you hardcode those settings in the ASPRunner.NET itself - does it work?
Also, what exactly happens when you applying this code?


Hello, thank you for your respond.
My version is last build 10.4 (34835)
The error Just: error sending the email...
My code in button is this:
string subject = "Factura " + data["Fra"].ToString() + "";

string email = XSession.Session["email"];

string from = "administracion@intrasoft.es";

string htmlbody = "<!DOCTYPE html><html><body>" + Environment.NewLine

+"Estimado cliente " + data["Contacto"].ToString() +",

Desde el siguiente <a href=" + data["Report"].ToString() + ">vínculo,</a>" + Environment.NewLine

+" usted se podrá descargar la factura " + data["Fra"].ToString() + ", correspondiente a la prestación de nuestros servicios. Muchas gracias." + Environment.NewLine

+"<p>Saludos Cordiales
"
XVar res;

res = MVCFunctions.runner_mail(new XVar("to", email, "subject", subject, "htmlbody", htmlbody, "from", from));
if(!res["mailed"])

{

MVCFunctions.EchoToOutput(res["message"]);

}
This works if I put the same parameters in the built in email settings.....
When I remove the email settings just error.....

Sergey Kornilov admin 4/21/2020

You need to publish your project to Demo Account and contact support directly. Not much can be done by just looking at this code.

T
tetter 4/24/2020

Hi there
The settings

  • GlobalVars.globalSettings.InitAndSetArrayItem(true, "useCustomSMTPSettings");
  • GlobalVars.globalSettings.InitAndSetArrayItem("smtp.office365.com", "strSMTPServer");
  • ...
    are NOT used in the runner_mail function ... you would need to extend the runner_mail in the MVCFunctions.cs. I have just done this and then it works. I just don't know how to attach a file here.
    The only thing I couldn't find out was, where the switch "useCustomSMTPSettings" is used.
    Regards Tom

Sergey Kornilov admin 4/24/2020

I would like to apologize for misleading everyone. This functionality doesn't work as intended at the moment and we will fix it in the next update of v10.4.