title: how to send mail on clssical asp by using the .config file
body: <p>I have a classic asp project. On this project I need to send mail. I need helping hand to send mail from classical asp by using the bellow .config file information.</p>
  
  <pre><code>  &lt;appSettings&gt;
      &lt;add key="smtpHost" value="smtp.gmail.com" /&gt;
      &lt;add key="smtpPort" value="587" /&gt;
      &lt;add key="emailTo" value="xxx@gmail.com" /&gt;
      &lt;add key="emailFrom" value="yyy@gmail.com" /&gt;
      &lt;add key="smtpUser" value="smtp.test@nazdaqTechnologies.com" /&gt;
      &lt;add key="smtpUserPassword" value="test.smtp" /&gt;
      &lt;add key="emailSubject" value="Email Auto Reorder for callback" /&gt;
      &lt;add key="smtpDomain" value="" /&gt;
      &lt;add key="ClientSettingsProvider.ServiceUri" value="" /&gt;
    &lt;/appSettings&gt;
  </code></pre>
  
  <p>In asp.net I use bellow syntax to send mail</p>
  
  <pre><code>System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
  message.To.Add("luckyperson@online.microsoft.com");
  message.Subject = "This is the Subject line";
  message.From = new System.Net.Mail.MailAddress("From@online.microsoft.com");
  message.Body = "This is the message body";
  System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("yoursmtphost");
  smtp.Send(message);
  </code></pre>
  
  <p>I'm just getting into classical asp, so forgive me if this is a basic question. I need help to send mail by using the .config file information .</p>
  
  <p><strong>I Just want to be able to send an email from my website to a given email address using my gmail account (smtp server).
  I have the following code which others have using successfully, but i get  error</strong></p>
  
  <pre><code>&lt;%
  Set objCDOSYSMail = Server.CreateObject("CDO.Message")
  Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
  
  ''# Authenticate if necessary
  objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username@googlemail.com"
  objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mygmailpassword"
  
  ''# Outgoing SMTP server configuration
  objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
  objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
  objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
  
  ''# Update the CDOSYS Configuration
  Set objCDOSYSMail.Configuration = objCDOSYSCon
  objCDOSYSMail.From = "username@googlemail.com" ''# This has to be valid email address on the selected SMTP server
  strSubject = "Email test"
  strHTML = "This is a test"
  objCDOSYSMail.To = "username@hotmail.com"
  objCDOSYSMail.Subject = strSubject
  objCDOSYSMail.HTMLBody = strHTML
  objCDOSYSMail.Send 
  %&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/YDMnT.png" alt="enter image description here"></p>
  
  <p>This is a discussion on Error: 006~ASP 0177~Server.CreateObject Failed~800401f3 –asp show me the above error . Can any one help please to solve this issue------------------------------------------------------------------------------------------- Without <code>Set objCDOSYSMail = Server.CreateObject("CDO.Message")</code>  The asp file was working fine  on my os =win7 and win-server-2003 r2.</p>