This topic is locked
[SOLVED]

 emailing html msg body

6/15/2018 3:25:17 PM
ASPRunner.NET General questions
H
heilmanmd author

Have successfully been able to send email using ASP Runner_Mail in asprunner.net ver 9.8
no issue...
Tried to send HTML msg body and it delivered ok, however receiving email showed the HTML text
hum....
Did some research and see that there is a setting in .NET for sending an HTML msg body as shown below
msg.IsBodyHtml = true;
but no where in ASP Runner_mail do I see such a setting that can be set
So....
is there any way to set/pass a flag or something that will allow for html msg body to be sent??

Pete K 6/16/2018

Hi. This is simple. Rather than using the body attribute of runner_mail function, use htmlbody.
This is documented in the help file. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=85212&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />
https://xlinesoft.com/asprunnernet/docs/runner_mail_function.htm
Cheers!

H
heilmanmd author 6/16/2018

Pete
Appreciate the quick reply...
I tried that and it didn't work...
Here's all my testing to prove such, and reason seeking assistance...
Hopefully somebody can try my testing and validate the results...
This is what I put in my after successful login event
string email = "mark.heilman@icloud.com";

string from = "noreply@stillwatermining.com";

string msg = "Hello there\n<b>Best regards</b>";

string subject = "Sample subject";

XVar result;

result = MVCFunctions.runner_mail(new XVar("to", email, "subject", subject, "body", msg, "from", from));
This is what what it looks like when received in both Gmail and Apple Mail
APPLE mail

From: noreply@stillwatermining.com

Date: June 16, 2018 6:28:50 PM

To: mark.heilman@icloud.com

Subject: Sample subject
Hello there<b>Best regards</b>
GMAIL

---------- Forwarded message ----------

From: <noreply@stillwatermining.com>

Date: Sat, Jun 16, 2018 at 6:32 PM

Subject: Sample subject

To: usemdh@gmail.com
Hello there

<b>Best regards</b>
So... I wrote a little ASP stand alone shown below

and can see the two types of methods to sending an email
i.e. textbody or htmlbody
using text body get same results as get in ASP Runner

using html body it works great.. html appears in emails
<%
Set myMail = CreateObject("CDO.Message")

myMail.Subject = "Sending email with CDO"

myMail.From = "noreply@smcinternal.com"

myMail.To = "mark.heilman@icloud.com"
'''' this work...

myMail.htmlBody = "<h1>send 5:37am by mark</h1>"
'''' this emulates what I get in ASP Runner .NET Ver9.8 using Runner_mail

''''myMail.textBody = "<h1>send 5:37am by mark</h1>"
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing";) = 2

'Name or IP of remote SMTP server

myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver";) = "smchub.smcinternal.com"

'Server port

myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport";) = 25

myMail.Configuration.Fields.Update
On Error Resume Next

myMail.Send

If Err.Number = 0 Then

set myMail = Nothing

Response.write "Email has been sent. <BR><BR>"

Else

set myMail = Nothing

Response.write "Error sending email.
Please contact IS Services...<BR><BR>"

End If
%>
And... it works,

i.e. now the html code appears in both Gmail and Apple Mail , see below
Apple Email
From: noreply@smcinternal.com

Date: June 16, 2018 6:45:25 PM

To: mark.heilman@icloud.com

Subject: Sending email with CDO
send 5:37am by mark
GMAIL
From: <noreply@smcinternal.com>

Date: Sat, Jun 16, 2018 at 6:49 PM

Subject: Sending email with CDO

To: usemdh@gmail.com
send 5:37am by mark
So... My bet is that ASP Runner is hard coded as TEXTBODY
and the reason asked if there is some switch or something I can send to Runner Mail to get it to use HTMLBODY
Appreciated any thoughts / feedback / help
i.e. can someone else try by testing / debug to see if they get the same results...

T
Tim 6/17/2018

It looks like there may be a type-o in the manual. Try this:
result = MVCFunctions.runner_mail(new XVar("to", email, "subject", subject, "htmlbody", msg, "from", from));
Notice the "htmlbody" instead of just "body".
Good luck!

Tim

H
heilmanmd author 6/18/2018

Tim
Wonderful, works great... much appreciated.
Best

Mark

Pete K 6/18/2018

I'm really confused as to why you all are saying there is an error in the manual or why all the confusion. It's very straightforward and I said the same thing Tim said.
Here's the relevant part from the manual page I linked to:
[font=Verdana, Geneva, Arial, sans-serif]_params - array with input parameters. The following parameters are supported:
[font=Verdana, Geneva, Arial, sans-serif][size=2]•to - receiver email address.[/size]
[font=Verdana, Geneva, Arial, sans-serif][size=2]•bcc - email addresses of recipients whose addresses are not to be revealed to other recipients of the message.[/size]
[font=Verdana, Geneva, Arial, sans-serif][size=2]•htmlbody - html message body (do not use 'body' parameter in this case).[/size]
[font=Verdana, Geneva, Arial, sans-serif][size=2]•attachments - attachments description.[/size]

T
Tim 6/18/2018

Hi Pete,
You are correct, but if you look further down in on that page there is an example called "Send HTML email" and this example doesn't change from "body" to "htmlbody". I, for one, work off the examples due to my laziness <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=85218&image=1&table=forumreplies' class='bbc_emoticon' alt=':blink:' /> . I assume this was what Mark was looking at too.
Thanks,

Tim

H
heilmanmd author 6/25/2018

Yes.. that is what I was doing... assuming that the examples are tried / true and tested...
Bad assumption...
Mark