Forums

ASP

This topic is locked

CDO.Message.1 error '80040220'

Posted 10 Jul 2008 15:21:29
1
has voted
10 Jul 2008 15:21:29 samara Nouri posted:
Hi

Do you have any idea to fix this problem. It's very urgent!

CDO.Message.1 error '80040220' The "SendUsing" configuration value is invalid.

Here's my code: Enews.asp
<
%Dim myMailer, strTo, strBcc, strSubject, strBody
' E-mail header information
strTo = "sakader@sorouh.com"
'strTo = "sakader@sorouh.com"
strBcc = Request.Form("Recipients")
strSubject = "Sorouh - Internal Newsletter"

' This is the body of the e-mail
strBody = "<html>"
strBody = strBody & "<head>"
'strBody = strBody & "<link href='applestore.css' rel='stylesheet' media='all' type='text/css'>"
'strBody = strBody & "<style>"
'strBody = strBody & "<!--"
'strBody = strBody & ".style2 {font-size: 12px; color: #000000; font-family: Verdana;}"
'strBody = strBody & ".style3 {font-size: 12px}"
'strBody = strBody & ".style5 {font-size: 30px; color: #FFFFFF; font-family: Broadway;}"
'strBody = strBody & ".style9 {font-family: Verdana; font-size: 10px; color: #CCCCCC; font-weight: bold;}"
'strBody = strBody & "body, td, th {font-family: Verdana;}"
'strBody = strBody & "body {background-color: #192D47;}"
'strBody = strBody & ".style11 {font-family: Verdana; font-size: 12px; color: #000000;}"
'strBody = strBody & ".style12 {font-size: 16px; color: #660000; font-family: Verdana; font-weight: bold;}"
'strBody = strBody & ".style13 {color: #003366; font-weight: bold;}"
'strBody = strBody & ".style21 {font-size: 10px; font-weight: bold; color: #FFFFFF;}"
'strBody = strBody & "a:link {color: #3366CC; text-decoration: none;}"
'strBody = strBody & "a:visited {color: #3366CC; text-decoration: none;}"
'strBody = strBody & "a:hover {color: ##990000; text-decoration: none;}"
'strBody = strBody & "a:active {text-decoration: none;}"
'strBody = strBody & "a.1:link {color: #CCFFFF; text-decoration: underline;}"
'strBody = strBody & "a.1:visited {color: #CCFFFF; text-decoration: underline;}"
'strBody = strBody & "a.1:hover {color: #66CCFF; text-decoration: none;}"
'strBody = strBody & "a.1:active {color: #CCFFFF; text-decoration: underline;}"
'strBody = strBody & ".style22 {font-size: 11px}"
'strBody = strBody & ".style23 {font-size: 11px; font-weight: bold; color: #FFFFFF;}"
'strBody = strBody & "-->"
'strBody = strBody & "</style>"
strBody = strBody & "</head>"
'header ends
strBody = strBody & "<body>"
strBody = strBody & "<font face='Arial'>This is my message</font>"
'strBody = strBody & "<div align='center'>"
'strBody = strBody & "<table width='600' border='0' cellpadding='0' cellspacing='0' bgcolor='#090909'>"
'strBody = strBody & "<tr>"
'strBody = strBody & "<td colspan='5' valign='top' bgcolor='#FFFFFF'>"
'strBody = strBody & "<p align='center'>"
'strBody = strBody & "<span class='style2'><a name='top0'></a>If you do not see the graphics below,</span>"
'strBody = strBody & "<font  face='Verdana' color='#000000' size='2'>"
'strBody = strBody & "<b>"
'strBody = strBody & "<a target='_blank' style='text-decoration: none' href='http://eNews.htm'>click here</a></b></font><span class='style2'> to view in a new window.</span>"
'strBody = strBody & "</td>"
'strBody = strBody & "</tr>"
'strBody = strBody & "<tr>"
'strBody = strBody & "<td colspan='5' valign='top' bgcolor='#FFFFFF'><p align='center'> &nbsp;</td></tr>"
'strBody = strBody & "<tr><td height='233' colspan='5'>"
'strBody = strBody & "<p align='center'><span class='style5'>Sorouh Internal Newsletter</span></td>"
'strBody = strBody & "</tr>"
'strBody = strBody & "<tr>"
'strBody = strBody & "<td height='39' colspan='2' valign='middle' bgcolor='#333333'><div align='center'><span class='style9'>JULY 2008</span></div></td>"
'strBody = strBody & "<td width='14' rowspan='2' valign='top' bgcolor='#FFFFFF'>&nbsp;</td>"
'strBody = strBody & "<td width='401' rowspan='2' valign='top' bgcolor='#FFFFFF'>"
'strBody = strBody & "<p align='left'><a name='top'></a></p>"
'strBody = strBody & "<p align='left' class='style12'>Title</p>"
'strBody = strBody & "<p align='left' class='style2'> Content</p>"
'strBody = strBody & "<p align='left' class='style2'> &nbsp;</p>"
'strBody = strBody & "</td>"
'strBody = strBody & "<td width='35' rowspan='2' valign='top' bgcolor='#FFFFFF'>"
'strBody = strBody & "<img src='enews_spacer3.gif' width='28' height='5'></td>"
'strBody = strBody & "</tr>"
'strBody = strBody & "<tr>"
'strBody = strBody & "<td width='12' valign='top' bgcolor='#666666'>&nbsp;</td>"
'strBody = strBody & "<td width='138' valign='top' bgcolor='#666666'>"
'strBody = strBody & "<p align='left' class='style21'><span class='style22'><a href='#top'>"
'strBody = strBody & "<font color='#FFFFFF'>Item 1</font></a></span><br></p>"
'strBody = strBody & "<p align='left'>"
'strBody = strBody & "<a href='#special'><font color='#FFFFFF'><span class='style23'>Item 2<BR></span></font></a><br>"
'strBody = strBody & "<a href='#live'><font color='#FFFFFF'><span class='style23'>Item 3</span></font></a><br><br>"
'strBody = strBody & "<span class='style21 style22'><strong><a href='#partner'><font color='#FFFFFF'>Item 4</font></a><br><br></strong></span><span class='style22'><strong>"
'strBody = strBody & "<a href='#overview'>strBody = strBody & "<font color='#FFFFFF'>Item 5</font></a></strong></span></p>"
'strBody = strBody & "<p align='left' class='style23'>"
'strBody = strBody & "<span class='style22'><strong><a href='#first'><font color='#FFFFFF'>Item 6</font></a></strong></span>"
'strBody = strBody & "</p>"
'strBody = strBody & "<p align='left' align='center'>"
'strBody = strBody & "<img border='0' src='Sorouh_Logo.gif' width='156' height='79'></p>"
'strBody = strBody & "<p align='left' align='left'>&nbsp;</p>"
'strBody = strBody & "</td>"
'strBody = strBody & "</tr>"
'strBody = strBody & "</table>"
'strBody = strBody & "</div>"
strBody = strBody & "</body></html>"


' Send email using CDOSYS
Set myMailer = Server.CreateObject("CDO.Message")
myMailer.From = "eNews@sorouh.ca"
myMailer.To = strTo
myMailer.Bcc = strBCC
myMailer.Subject = strSubject
myMailer.HTMLBody = strBody
myMailer.Send
Set myMailer = Nothing


' Confirmation page
Response.Write ("<html>")
Response.Write ("<head>")
Response.Write ("<meta http-equiv=Content-Language' content=en-ca'>")
Response.Write ("<meta http-equiv=Content-Type' content=text/html; charset=windows-1252'>")
Response.Write ("<title>Sorouh - Internal Newsletter</title>")
Response.Write ("</head>")
Response.Write ("<body>")
Response.Write ("<div align='center'>")
Response.Write ("<center>")
Response.Write ("<table border='0' cellpadding='0' cellspacing='0' width='540'>")
Response.Write ("<tr>")
Response.Write ("<td width='100%' align='center'>")
Response.Write ("<font face='Arial'>The eNewsLetter has been successfully broadcast to all recipients.</font></td>")
Response.Write ("</tr>")
Response.Write ("</table>")
Response.Write ("</center>")
Response.Write ("</div>")
Response.Write ("</body>")
Response.Write ("</html>")
%>

The recipients are sent throgh another HTML page

<head>
<meta http-equiv="Content-Language" content="en-ca">
<link rel="stylesheet" href="http://intl.imimages.com/upload/FT-EN/files/IMC_StaticPgs.css">
<title>Sorouh - Internal Newsletter</title>
<style>
<!--
p, td, li, ul, ol, blockquote, div, span {font-family : arial;font-size : 10pt;color : #FFFFFF;}
h2 {font-family : arial;font-weight : bold;font-size : 14pt;color : #FFFFFF;}
a.1:link {color : #FFFFFF;font-family : arial;font-size : 10pt;text-decoration : underline;} 
a.1:visited {color : #FFFFFF;font-family : arial;font-size : 10pt;text-decoration : underline;}
a.1:hover {color : #FFFFFF;font-family : arial;font-size : 10pt;text-decoration : none;}   
a.1:active {color : #FFFFFF;font-family : arial;font-size : 10pt;text-decoration : underline;}
-->
</style>
</head>

<body onLoad="document.frmBroadcast.Recipients.focus();">

<script Language="JavaScript" Type="text/javascript">
<!--
function frmBroadcast_Validator(theForm)
{

  if (theForm.Recipients.value == "")
  {
    alert("Please enter a value for the \"The is no content in the recipient box\" field.");
    theForm.Recipients.focus();
    return (false);
  }
  return (true);
}
//-->
</script>

<form method="POST" action="http://intranet:81/Enews.asp" onsubmit="return frmBroadcast_Validator(this)" language="JavaScript" name="frmBroadcast">
  <div align="center">
    <center>
      <table border="0" cellpadding="0" cellspacing="0" width="600">
        <tr>
          <td rowspan=5>
            <img src=http://a1920.g.akamai.net/f/1920/1080/8h/intl.imimages.com/upload/FT-EN/images/1x1clear.gif width="2">
          </td>
          <td>
            <img src=http://a1920.g.akamai.net/f/1920/1080/8h/intl.imimages.com/upload/FT-EN/images/1x1clear.gif width="2">
          </td>
          <td rowspan="5">
            <img src=http://a1920.g.akamai.net/f/1920/1080/8h/intl.imimages.com/upload/FT-EN/images/1x1clear.gif width="2" >
          </td>
        </tr>
        <tr>
          <td width="100%" height="175" bgcolor="#192D47">
            <p align="center"><font face="Broadway" size="6">Sorouh Internal Newsletter
			</font>
          </td>
        </tr>
        <tr>
          <td>
            <table border="0" cellpadding="2" cellspacing="5" width="100%" bgcolor="#192D47">
              <tr>
                <td width="100%">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
                    <tr>
                      <td>
                        <a name="Top"></a>
                        <div align="center">
                          <center>
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td width="100%" align="center">
                                  <table width="100%" border="3" cellspacing="0" cellpadding="0" style="border-style:double">
                                    <tr>
                                      <td width="100%" colspan="2">
                                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                          <tr>
                                            <td align="center" height="15"><br><h4><font color="#86A2A6">Mailer Administration Page</font></h4></td>
                                          </tr>
                                          <tr>
                                            <td align="center">
                                              <font color="#86A2A6"><b>Note:</b></font> Type or paste e-mail addresses of recipients below.<br>
                                              Ensure addresses are valid and are separated by a semi-colon (;)
                                            </td>
                                          </tr>
                                          <tr>
                                            <td align="center" height="15"></td>
                                          </tr>
                                          <tr>
                                            <td align="center"><textarea rows="15" name="Recipients" cols="65" class="txtInput"></textarea></td>
                                          </tr>
                                          <tr>
                                            <td>&nbsp;</td>
                                          </tr>
                                          <tr>
                                            <td align="center">
                                              <input type="submit" value="Send Broadcast Now!" class="txtInput">
                                              <input type="reset" value="Reset" name="Clear" class="txtInput">
                                              <br><br>
                                            </td>
                                          </tr>
                                        </table>
                                      </td>
                                    </tr>
                                  </table>
                                </td>
                              </tr>
                            </table>
                          </center>
                        </div>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>  
            </table>
          </td>
        </tr>
        <tr>
          </tr>
      </table>
    </center>
  </div>
</form>

</body>

</html>

Replies

Replied 14 Jul 2008 21:30:29
14 Jul 2008 21:30:29 Georgi Kralev replied:
Hi Samara,

It looks like that you have not set CDO Configuration.

1. If you user local SMTP server for sending your emails the required code may look like this:
sch ="schemas.microsoft.com/cdo/configuration/"
Set cdoConfig=server.CreateObject("CDO.Configuration"
cdoConfig.Fields.Item(sch & "sendusing" = 1
cdoConfig.Fields.Update
Set myMailer.Configuration = cdoConfig


2. If you use external SMTP server you should set server name, port, authentication, username and password.
For example the required code may look like this:

sch ="schemas.microsoft.com/cdo/configuration/"
Set cdoConfig=server.CreateObject("CDO.Configuration"
cdoConfig.Fields.Item(sch & "sendusing" = 2
cdoConfig.Fields.Item(sch & "smtpserver" = "&lt;enter_mail_servername_here&gt;"
cdoConfig.Fields.Item(sch & "smtpserverport" = 25 'Default port is 25. Change it to the port of you SMTP server


If your SMTP server requires authentication you may have to include code like this:
cdoConfig.Fields.Item(sch & "smtpauthenticate" = 1 'cdobasic
cdoConfig.Fields.Item(sch & "sendusername" = "&lt;enter_mail_server_username_here&gt;"
cdoConfig.Fields.Item(sch & "sendpassword" = "&lt;enter_mail_server_password_here&gt;"

Update the configured CDO Configuration fields and set it to your Message

cdoConfig.Fields.Update
Set myMailer.Configuration = cdoConfig

For more information using CDO check the following articles:
classicasp.aspfaq.com/email/how-do-i-send-e-mail-with-cdo.html
www.w3schools.com/asp/asp_send_email.asp
msdn.microsoft.com/en-us/library/aa579722(EXCHG.80).aspx

I hope this helps you.

Note: I have not checked my code. Therefore, it may contain some errors.

Best regards,

Georgi Kralev

Homepage: gdkralev.googlepages.com
Replied 04 Nov 2009 23:43:09
04 Nov 2009 23:43:09 Shantanu Kumar replied:

Reply to this topic