Skip to main content
February 23, 2009
Answered

Defining oMail in CDOsys

  • February 23, 2009
  • 1 reply
  • 709 views
I'm using CDOsys through my hosting provider (GoDaddy) to send an email when my Access database has been changed. The CDOsys code, as provided by GoDaddy, is within the insert command in DW; here's the code right before the CDOsys info and right after:

MM_editCmd.ActiveConnection.Close();

//body of email
mailbody = "the message goes here."

//Send the e-mail
MailMessage oMail = new System.Web.Mail.MailMessage();
oMail.From = "emailaddress@domainname";
oMail.To = "test@test.com";
oMail.Subject = "Test email subject";
oMail.BodyFormat = MailFormat.Html; // enumeration
oMail.Priority = MailPriority.High; // enumeration
oMail.Body = "Sent at: " + DateTime.Now;
SmtpMail.SmtpServer = "relay-hosting.secureserver.net";
SmtpMail.Send(oMail);
oMail = null; // free up resources

if (MM_editRedirectUrl) {

I get this error:
Microsoft JScript compilation error '800a03ec'
Expected ';'
MailMessage oMail = new System.Web.Mail.MailMessage();

How do I define oMail properly, using ASP javascript, to send the email?
This topic has been closed for replies.
Correct answer
thanks, I found it. The javascript ASP code is:


//Send the e-mail
{

var objMessage=Server.CreateObject("CDO.Message");
objMessage.Subject="Subject here";
objMessage.From="Email address here";
objMessage.To="Email address here";
objMessage.HtmlBody="<p>HTML content here.</p>";
objMessage.Configuration.Fields.Item(" http://schemas.microsoft.com/cdo/configuration/smtpserver")="Hosting provider's SMTP info here.";
objMessage.Send();
}

1 reply

Inspiring
February 23, 2009
jennivazquez wrote:
> I'm using CDOsys through my hosting provider (GoDaddy) to send an email when my
> Access database has been changed. The CDOsys code, as provided by GoDaddy, is
> within the insert command in DW; here's the code right before the CDOsys info
> and right after:
>
> MM_editCmd.ActiveConnection.Close();
>
> //body of email
> mailbody = "the message goes here."
>
> //Send the e-mail
> MailMessage oMail = new System.Web.Mail.MailMessage();
> oMail.From = "emailaddress@domainname";
> oMail.To = "test@test.com";
> oMail.Subject = "Test email subject";
> oMail.BodyFormat = MailFormat.Html; // enumeration
> oMail.Priority = MailPriority.High; // enumeration
> oMail.Body = "Sent at: " + DateTime.Now;
> SmtpMail.SmtpServer = "relay-hosting.secureserver.net";
> SmtpMail.Send(oMail);
> oMail = null; // free up resources
>
> if (MM_editRedirectUrl) {
>
> I get this error:
> Microsoft JScript compilation error '800a03ec'
> Expected ';'
> MailMessage oMail = new System.Web.Mail.MailMessage();
>
> How do I define oMail properly, using ASP javascript, to send the email?
>

That code is C# for ASP.NET websites. You'll need to ask Godaddy for the
Javascript code for ASP websites.

--


Julian Roberts

http://www.charon.co.uk
Correct answer
February 23, 2009
thanks, I found it. The javascript ASP code is:


//Send the e-mail
{

var objMessage=Server.CreateObject("CDO.Message");
objMessage.Subject="Subject here";
objMessage.From="Email address here";
objMessage.To="Email address here";
objMessage.HtmlBody="<p>HTML content here.</p>";
objMessage.Configuration.Fields.Item(" http://schemas.microsoft.com/cdo/configuration/smtpserver")="Hosting provider's SMTP info here.";
objMessage.Send();
}