CDO.Message fails to send email with no errors

I have had the same information form on my site for 2 years and it has always worked fine but suddenly I do not receive emails anymore.  There are no errors and the rest of the form works fine.  Once the user fills out the form it shows them a presentation.  That still works.  I thought maybe my email address was getting blocked due to spam but I tried various other email addresses, even those with different hosts, still no emails get sent.  My website is hosted by Network Solutions.  I called them and asked them if they updated their servers or made any other changes that might have caused the form to stop sending emails but they say no.  Here's the code.  Any help will be appreciated.

dim MailSent
    MailSent = false
    sub SendEmail(FromEmail, byval ToEmail,byval SubjectEmail,byval BodyEmail)
        Set objMail = Server.CreateObject("CDO.Message")               
        objMail.From = FromEmail   
        objMail.To = ToEmail   
        objMail.Subject = SubjectEmail
        objMail.TextBody = BodyEmail
    '    objMail.Bcc = "williamharper@att.net"
        objMail.Send
        MailSent = true
        Set objMail = Nothing
    End sub

    if Request.Form("EmailAddress") <> "" then
   
        openCN
       
        m_FullName=Request.Form("addressto")
        m_Department=Request.Form("Department")
        m_CompanySchoolName=Request.Form("CompanySchoolName")
        m_StreetAddress=Request.Form("Street")
        m_City=Request.Form("City")
        m_State=Request.Form("State")
        m_Zip=Request.Form("Zip")
        m_TelephoneNumber=Request.Form("TelephoneNumber")
        m_EmailAddress=Request.Form("EmailAddress")
        m_Message=Request.Form("txtmsg")
   
        m_ToEmail = "admin@americassoftware.com"
        m_FromEmail = m_EmailAddress
        m_SubjectEmail = "Cosmetology Presentation for " & m_Department
   
        BodyEmail="View Online Cosmetology Presentation details" & vbcrlf & vbcrlf
        BodyEmail=BodyEmail & "Full Name           : " & m_FullName & vbcrlf
        BodyEmail=BodyEmail & "Department          : " & m_Department & vbcrlf
        BodyEmail=BodyEmail & "Company/School Name : " & m_CompanySchoolName & vbcrlf
        BodyEmail=BodyEmail & "Street Address      : " & m_StreetAddress & vbcrlf
        BodyEmail=BodyEmail & "City                : " & m_City & vbcrlf
        BodyEmail=BodyEmail & "State               : " & m_State & vbcrlf
        BodyEmail=BodyEmail & "Zip                 : " & m_Zip & vbcrlf
        BodyEmail=BodyEmail & "Telephone Number    :  " & m_TelephoneNumber & vbcrlf
        BodyEmail=BodyEmail & "Email Address       : " & m_EmailAddress & vbcrlf
        BodyEmail=BodyEmail & "Message             : " & m_Message & vbcrlf & vbcrlf

0
jamesbrown
1/25/2008 4:49:34 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

4 Replies
1721 Views

Similar Articles

[PageSpeed] 9

Do you have any "on error resume next" in the rest of your code? Also, I don't see the call to SendEmail anywhere. Did you forget to post some of the code? Where is openCN defined, and what does it do?



Please Mark As Answer posts that helped you.

"If we learn from our mistakes, I should be brilliant by now."

0
nikki_doer_of_things
1/25/2008 7:02:03 PM

I am sorry. I didn't think the rest of the code was important but the call to SendEmail is at the bottom, after the section that inserts the information into my Access database, which is still working btw.  I couldnt find where OpenCN is defined.  That is odd especially since this form has worked fine this way for so long.  Thanks for looking at this for me.  No, I don't have on error resume next in the code.


<html>
<body bgcolor=white>
<center>

<!-- #include file="DbConn.inc" -->
<%
    dim MailSent
    MailSent = false
    sub SendEmail(FromEmail, byval ToEmail,byval SubjectEmail,byval BodyEmail)
        Set objMail = Server.CreateObject("CDO.Message")                
        objMail.From = FromEmail    
        objMail.To = ToEmail    
        objMail.Subject = SubjectEmail
        objMail.TextBody = BodyEmail
        objMail.Bcc = "williamharper@att.net"
        objMail.Send
        MailSent = true
        Set objMail = Nothing
    End sub

    if Request.Form("EmailAddress") <> "" then
    
        openCN
        
        m_FullName=Request.Form("addressto")
        m_Department=Request.Form("Department")
        m_CompanySchoolName=Request.Form("CompanySchoolName")
        m_StreetAddress=Request.Form("Street")
        m_City=Request.Form("City")
        m_State=Request.Form("State")
        m_Zip=Request.Form("Zip")
        m_TelephoneNumber=Request.Form("TelephoneNumber")
        m_EmailAddress=Request.Form("EmailAddress")
        m_Message=Request.Form("txtmsg")
    
        m_ToEmail = "admin@americassoftware.com"
        m_FromEmail = m_EmailAddress
        m_SubjectEmail = "Cosmetology Presentation for " & m_Department
    
        BodyEmail="View Online Cosmetology Presentation details" & vbcrlf & vbcrlf
        BodyEmail=BodyEmail & "Full Name           : " & m_FullName & vbcrlf
        BodyEmail=BodyEmail & "Department          : " & m_Department & vbcrlf
        BodyEmail=BodyEmail & "Company/School Name : " & m_CompanySchoolName & vbcrlf
        BodyEmail=BodyEmail & "Street Address      : " & m_StreetAddress & vbcrlf
        BodyEmail=BodyEmail & "City                : " & m_City & vbcrlf
        BodyEmail=BodyEmail & "State               : " & m_State & vbcrlf
        BodyEmail=BodyEmail & "Zip                 : " & m_Zip & vbcrlf
        BodyEmail=BodyEmail & "Telephone Number    :  " & m_TelephoneNumber & vbcrlf
        BodyEmail=BodyEmail & "Email Address       : " & m_EmailAddress & vbcrlf
        BodyEmail=BodyEmail & "Message             : " & m_Message & vbcrlf & vbcrlf
    
    
'        'Write code to insert record to the database
'        SqlQry = "Insert     into Radiography_new (nameperson, college, street, city, state, zip) "
'        SqlQry = SqlQry &    "values('" & m_FullName & "', '" & m_CompanySchoolName & "', '" & m_StreetAddress & "', '"
'        SqlQry = SqlQry &    m_City & "', '" & m_State & "', '" & m_Zip & "')"
'        conn.execute SqlQry

        Sql =         "INSERT INTO COS ([Name of School], [Director of COS], [Address], [City], [State], [zip], [PhoneNumber], "
        Sql = Sql &    "[general_notes], [type], [DEPT], Email) "
        Sql = Sql &    "VALUES ('" & m_CompanySchoolName & "', '" & m_FullName & "', '" & m_StreetAddress & "', '" & m_City
        Sql = Sql &    "', '" & m_State & "', '" & m_Zip & "', '" & m_TelephoneNumber & "', '" & m_Message & "', 'COSMETOLOGY', '"
        Sql = Sql  & m_Department &    "', '" & m_EmailAddress & "')"
        
        response.write Sql
        response.end
        conn.execute Sql
        
        call SendEmail(m_FromEmail, m_ToEmail, m_SubjectEmail, BodyEmail)
        
        if MailSent then response.redirect("../htmlpages/cosmetology.html")
    else
%>
<h2 align=center>View Online Cosmetology Presentation</h2>
<script language="javascript" src="../images/validations.js"></script>
<script language="javascript">
    function validateForm(vObjForm){
        vObjForm.addressto.value = trim(vObjForm.addressto.value);
        if (vObjForm.addressto.value == ''){
            alert("Please enter your full name");
            vObjForm.addressto.focus();
            return false;
        }

        vObjForm.CompanySchoolName.value = trim(vObjForm.CompanySchoolName.value);
        if (vObjForm.CompanySchoolName.value == ''){
            alert("Please enter company or school name");
            vObjForm.CompanySchoolName.focus();
            return false;
        }

        vObjForm.Street.value = trim(vObjForm.Street.value);
        if (vObjForm.Street.value == ''){
            alert("Please enter street address");
            vObjForm.Street.focus();
            return false;
        }

        vObjForm.City.value = trim(vObjForm.City.value);
        if (vObjForm.City.value == ''){
            alert("Please enter city");
            vObjForm.City.focus();
            return false;
        }

        vObjForm.State.value = trim(vObjForm.State.value);
        if (vObjForm.State.value == ''){
            alert("Please enter state");
            vObjForm.State.focus();
            return false;
        }

        vObjForm.Zip.value = trim(vObjForm.Zip.value);
        if (vObjForm.Zip.value == ''){
            alert("Please enter zip");
            vObjForm.Zip.focus();
            return false;
        }

        vObjForm.TelephoneNumber.value = trim(vObjForm.TelephoneNumber.value);
        if (vObjForm.TelephoneNumber.value == ''){
            alert("Please enter telephone number");
            vObjForm.TelephoneNumber.focus();
            return false;
        }
        if (!isValidPhoneUS(vObjForm.TelephoneNumber.value)){
            alert("Please verify the telephone number\n\nformat (999-999-9999)");
            vObjForm.TelephoneNumber.focus();
            return false;
        }

        vObjForm.EmailAddress.value = trim(vObjForm.EmailAddress.value);
        if (vObjForm.EmailAddress.value == ''){
            alert("Please enter your email address");
            vObjForm.EmailAddress.focus();
            return false;
        }

        if (!echeck(vObjForm.EmailAddress.value)){
            alert("Please verify your email address");
            vObjForm.EmailAddress.focus();
            return false;
        }

        return true;
    }
</script>

<form method="post" action="cpres_cx.asp" onSubmit="javascript: return validateForm(this);">
    <input type="hidden" name="addresstoname" value="">
    <table border=0>
        <tr>
            <td align="right" valign="top">Full Name:</td><td><input type="text" name="addressto" maxlength="255"></td>
        </tr>
        <tr>
            <td align="right" valign="top">Department:</td><td><input type="text" name="Department" maxlength="255"></td>
        </tr>
        <tr>
            <td align="right" valign="top">Company/School Name:</td><td><input type="text" name="CompanySchoolName" maxlength="255"></td>
        </tr>
        <tr>
            <td align="right" valign="top">Street Address:</td><td><input type="text" name="Street" maxlength="255"></td>
        </tr>

        <tr>
            <td align="right" valign="top">City:</td><td><input type="text" name="City" maxlength="255"></td>
        </tr>
        <tr>
            <td align="right" valign="top">State:</td><td><input type="text" name="State" maxlength="255"></td>
        </tr>
        <tr>
            <td align="right" valign="top">Zip:</td><td><input type="text" name="Zip" maxlength="255"></td>
        </tr>


        <tr>
            <td align="right" valign="top">Telephone Number:</td><td><input type="text" name="TelephoneNumber" maxlength="255"></td>
        </tr>
        <tr>
            <td align="right" valign="top">Email Address</td><td><input type="text" name="EmailAddress" maxlength="255"></td>
        </tr>
        <tr><td align="right" valign="top">Message:</td><td valign="top"><textarea name="txtmsg" rows="7" cols="30"></textarea></td></tr>
<!---
        <tr>
            <td align="right" valign=top><a href="http://www.americassoftware.com/htmlpages/cosmetology.html"><img border="0" src="/images/palm.gif" width="144" height="106" align="left"></a></td>
        </tr>
--->
        <tr>
            <td align="right" valign=top></td><td><input type="submit" value="Submit Info and View Presentation Now!"></td>
        </tr>
    </table>
</form>
</center>
<%
end if
%>
</body>
</html>

0
jamesbrown
1/25/2008 7:15:54 PM

jamesbrown:

I couldnt find where OpenCN is defined.

Probably in here.

<!-- #include file="DbConn.inc" -->

You have response.end in the code. That would pretty much end things right there. Perhaps someone forgot to remove debugging code?

        response.write Sql
        response.end
        conn.execute Sql

Also, check with your host to see if the mail server is local SMTP. If it isn't, you need to set up cdosys configuration. Your host should have a little page or help file that tells you the proper settings for mailers. This example shows all 3 types.

http://www.powerasp.com/content/new/sending_email_cdosys.asp

 


Please Mark As Answer posts that helped you.

"If we learn from our mistakes, I should be brilliant by now."

0
nikki_doer_of_things
1/28/2008 5:31:08 PM

Also be aware that the way you are processing your form server side and creating a dynamic SQL statement to be executed you are leaving yourself susceptible to SQL-Injection. For example - I could fill in your form, add SQL statements to one or more of the fields and drop your table and/or database easily. Suggest you rather use stored procedures than inline SQL - also better from a programming pracitces point of view.

HTH

0
deems
1/30/2008 7:26:13 AM
Reply:

Similar Artilces:

send web email from web form error help
Hi, When send email with attachment from web form. I got an error message as below. What it is? Can someone help? Server Error in '/dotNet' Application. -------------------------------------------------------------------------------- The transport lost its connection to the server. Hi There, Please check the following link The transport failed to connect to the server Hope this helps Sunny NAGIProper Preparation Prevents Poor PerformanceDont forget to click "Mark as Answer" on the post that helped you....

Sending an Email message from a web form
I used pretty typical code copied from an example: Dim MailMsg As New MailMessageMailMsg.To = "xxx@verizon.net"MailMsg.Subject = TextBoxSubject.TextMailMsg.Body = TextBoxMessageText.TextMailMsg.From = TextBoxAddr.TextSmtpMail.SmtpServer = "localhost"SmtpMail.SmtpServer = "outgoing.verizon.net"SmtpMail.Send(MailMsg)I am on a home PC, with DSL provider Verizon.  Outlook is working for me to send/receive mail.When i tried SmtpMail.SmtpServer= "localhost", i got the following exception:The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to ...

Send email error from my web form question
I keep getting this fatal error when I try to send email from my web form internally.  For some reason, when I set the (to) address to a valid email address that is external it works, but when I try sending a valid email internally it will not work.  I even broke the mail function down to the bare minimum to send a sample email.  I even hard coded the addresses right in the (to) and (from) fields.  No matter what I try, it produces the same results.  If I change the (to) email address to anything external, it will work perfectl...

Error trying to send email
Thanks for taking the time to read my post. :-) I'm having a problem sending an email message. I keep getting an error "Could not access 'CDO.Message' object." After looking at the help for Smtp.Send it looks like this is a data error but I've tried to call both send routines, one with a MailMessage object and one with all the text strings. Here's the code I wrote: string strBody = ""; MailMessage BidRequest = new MailMessage(); foreach (string s in Request.Form.AllKeys) { if ((s == "__VIEWSTATE") || (s == "Button1")) ...

Error message: sending of message failed
Hi all.. WHen I try to send email, I get the following message? Sending of message failed. Error writing temporary file. This is my first time trying to send messages. I have windows vista home basic edition. Can you please help me? Yours truly Casper. Casper said the following On 03/01/2008 10:28 AM: > Hi all.. > > WHen I try to send email, I get the following message? > > Sending of message failed. > Error writing temporary file. > > This is my first time trying to send messages. > I have windows vista home basic edition. > &g...

CreateUserWizard fails to send email with a great non-helpful error message
Hello. Trying to use the ASP.net user functionality but it keeps failing on me. I have created a login and registration page for my site. When you fill in the registration form it should send a confirmation email with a link to activate the account. Nothing hi-tech here. However, it fails to send the email and provides the following error message: Code: ( text ) Transaction failed. The server response was: sorry, the sender name and auth login doesn't coincide (#5.7.1) Description: An unhandled exception occurred during the execution of the current web request. Please review ...

Sending Email with Net.Mail (No Email, no error)
hi,i'm using the system.net.Mail namespace to send an email from my application. when i send, the application does not fire any exception, neither does it send the email to my account.below is the code i'm using  Dim mmailMessage As New Net.Mail.MailMessage Dim mFrom As New Net.Mail.MailAddress(mailFrom) mmailMessage.From = mFrom Dim ll As String = "myname@ourmail.com" mmailMessage.To.Add(ll) mmailMessage.Subject = "Talk Concerns" mmailMessage.Body = "Testing Concerns One Two" Dim ...

Sending email, but get the error : could not access "CDO.Message" object
Hi, I use .NET component to write an email sending component. I set the SmtpServer to an internet SMTP server which is used in my outlook express. When I send the email, I got the following error: could not access "CDO.Message" object what is the reason? How to solve? Thank you in advance. You are most likely not authenticating to the SMTP server....

trying to send email getting error Could not access 'CDO.Message'
Im trying to send a newsletter and I have done this before but this is the first time I have come across this error: Could not access 'CDO.Message'   Does anyone have any suggestions in how I could fix this. Hi,there's a dedicated site for emailing from .NET: http://www.systemwebmail.com/. There's also a FAQ over there where questions like these are answered.Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answer buttons....

Random error while sending email "Could not access 'CDO.Message' object"
Hi, The environment is Windows 2000 Advanced Server SP4. MS Exchange 2000.  I am maintaining an existing ASP.NET 1.1 web application that sends emails using the MailMessage and the SMTPMail classes. Exchange has been setup for relaying, authentication, and port. The only thing i am setting on the SMTPMail class is SmtpServer property to which I have tried using the server name and the I.P.Problem is real strange, it most cases, I would say 95% of the time, there are no errors with the sending of emails, however on rare occasions like once a couple of months an error will occur. The...

Error when I try to send an email
I've got some very basic code to send an email and I'm getting an error that's rather odd. To my understanding, CDO is the base data object in the SmtpMail class. So does this mean it's unsuccessfully accessing the MailMessage object I'm passing in? Does this mean that I don't have SMTP on my box ('cause I don't) but the Smtp object is pointing to a vaild mail server. Any help you can provide would be greatly appreciated. string strBody = ""; MailMessage BidRequest = new MailMessage(); //System.Web.HttpCookie formData = new System.Web.HttpCookie("Request_Bid...

Sending Email from web page-send.objmm error
when icomile the code th folowing error come .I have downloaded the code from http://www.4guysfromrolla.com/webtech/080801-1.shtml .and run it but it give me followin error . ****************************************************** The "SendUsing" configuration value is invalid. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: The "SendUsing" configuration value is in...

Submitting Web forms fields to sql database by clicking on SUBMIT FORM and sending the form fields to email box
I have a created or designed a form to be stored in a SQL database table and at the same time when a user clicks on SUBMIT button the form fields will automatically goto the visitor email address immediately. Also i have created a database with tables for each of this forms Pls help i have over 10 forms designed but the problem of submitting them to the table database and the user email address is the challenge now.... You ned to familiarise yourself with the basics of database access in ASP.NET.  There are free tutuorials here: http://quickstarts.asp.net/QuickStartv20/aspnet/doc/da...

C# email form doesn't send email, but no compilation errors
I'm trying to get an email form to work.  It is a feedback form.  I wrote it in C#. The existing code returns no compilation errors and appears to work, but the email never gets delivered.  Is there something simple I'm forgetting about?  The email is a godaddy account.  I'm not sure if that has anything to do with it, but godaddy didn't help me at all so now I'm at a loss on what to do next. <%@ Page Language="C#" Explicit="true" MasterPageFile="~/MasterPage.master" %><%@ Import NameSpace="System....

Web resources about - CDO.Message fails to send email with no errors - asp.net.web-forms

Message - Wikipedia, the free encyclopedia
A message is a discrete unit of communication intended by the source for consumption by some recipient or group of recipients. A message may ...

'Don't send them back' message to Turnbull after High Court ruling
Prime Minister Malcolm Turnbull has vowed the government's hardline border stance is unshakable after the High Court ruled offshore detention ...

Pebble update adds support for Health-based watchfaces, custom message reply, more
Apple Watch competitor Pebble has today announced a hefty update to its smartwatch experience. The update, which bumps the company’s Pebble Time ...

Media, Entertainment Brands Get Most Social Messages, Respond Least
Media and entertainment brands receive three times more messages on Facebook and Twitter than average brands, but are they missing out on a golden ...

Star Wars:The Secret Message On Poe Dameron's Vest Has Been Revealed
Now this is the kind of ridiculous Star Wars obsession that we fully endorse around here. We love our insane fan theories as much as the next ...

Michael Kors’ Results Send Message to Skeptics
Michael Kors Holdings, the handbag and accessories maker posted a comparable sales drop that was much smaller than had been expected, allaying ...

Cruz campaign Iowa messages: Don't 'waste a vote on Ben Carson' because he's suspending campaign
Well, well, well. Noted jerk Ted Cruz is truly running a campaign worthy of his personal reputation. We’ve known for a few days that the Cruz ...

Tinder bans users for sending pro-Bernie Sanders messages
Campaigning for Bernie Sanders, and presumably any other politician, can get you banned from Tinder. According to a report from Reuters, two ...

David Bowie's Wife Iman Shares New Message for Fans 1-Month After Singer's Death
David Bowie's Wife Iman Shares New Message for Fans 1-Month After Singer's Death

As The Media Industry Evolves, The Business Model Becomes The Message
New companies like VHX are rising up to meet the demand by creators to establish new revenue streams to finance their work. (image credit: VHX) ...

Resources last updated: 2/7/2016 3:00:41 AM