This topic is locked

Email - New Data , CC, BCC, HTML

2/16/2018 8:12:03 AM
ASPRunner.NET General questions
swat author

On event options, send email with new data, how I can add CC,BCC to the email function? Also, I want to use some html/table code for the budy section. How I can do that?

MK Frank R 2/16/2018

Here's a clip from my code.
Code the html in the email body, and use the keyword "htmlbody" for it.



//------------------------------------------------------------------------------------------------------------------------

// Send the email

//------------------------------------------------------------------------------------------------------------------------

XVar EmailStatus;

MVCFunctions.runner_mail(new XVar("to", ToAddresses, "subject", EmailSubject, "htmlbody", EmailBody, "from", FromAddress));


T
Tim 2/16/2018

Just for some more examples for you, here is one that I do. You can see that I build the HTML message with a combination of a field on the page, some hard-coded HTML , and some data from a master table. I also have a CC. You can do the same thing with Bcc.


XVar data = pageObject.getMasterRecord();

string email = values["SendTo"].Replace(",,",",").ToString().TrimEnd(",,".ToCharArray());

string from = "myemail@mydomain.com";

string cc = values["Cc"].ToString() ;

string msg = values["Note"].ToString() + "

<hr>
Original request:
" + data["Request"].ToString() ;

string subject = data["Subject"].ToString() + " - Note added to ticket: " + values["TicketID"].ToString();

XVar result;

result = MVCFunctions.runner_mail(new XVar("to", email, "cc", cc, "subject", subject, "htmlbody", msg, "from", from));

if(!result["mailed"])

{

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

}
admin 2/16/2018

ASPRunner.NET manual explains how to add CC, BCC and also how to send HTML emails:

https://xlinesoft.com/asprunnernet/docs/runner_mail_function.htm

swat author 2/19/2018



ASPRunner.NET manual explains how to add CC, BCC and also how to send HTML emails:

https://xlinesoft.com/asprunnernet/docs/runner_mail_function.htm


I am using the code sample on "public XVar AfterEdit", It looks good , but if I use "data["Subject"].ToString()" then I am getting an error "null ref"

swat author 2/22/2018

In addition also, I am getting an value("ID") on the edit page and using this ID value I need to get email address from another table. I am getting that query as well, but how I can seperate the 4-5 email address from here to email sending function?
XVar EmailCC = tDAL.DBLookup("SELECT [Email1],EMail2,Email3,Email4 FROM [Contact] WHERE ID='" + values["ID"].ToString() + "'");

XVar data = pageObject.getMasterRecord();

string email = EmailCC;

swat author 3/6/2018

Is it possible to get the email address from Active Directory base on the session?