Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 15 of 15
  1. #1
    New Coder
    Join Date
    Nov 2004
    Location
    Southampton, UK
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation ASP - CDOSYS mail script

    Hello,

    Basiclly i am having trouble with an asp script that sends the results of a form to an email address via CDOSYS with the email in HTML format, when the user clicks submit the action is set to the asp script, but i am not receiving anything and it appears to be doing nothing at all but sending me to an error 500 page.

    also i am insure if i am getting the details of a form field correctly, for example in the html email i have it so it shows Date: <the field submission here>

    if that makes sense, so it will show= Date: 20/01/04

    i have only done this for the date and reference fields the rest will just show <>.

    what i am using to do get the data from the form is: ShowFormField("Date")

    also i am unable to get it to redirect to "thanks.html" once completed.

    here is all of the code:

    Code:
                               
    <!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
           NAME="CDO for Windows 2000 Library" -->
    <!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4"
           NAME="ADODB Type Library" -->
    <!--This METADATA makes the CDO constants known to the system, like e. g. wie z.B. cdoSendUsingMethod-->
    <html>
    <body>
    <%
    Dim strFrom, strTo, strSubject, strBody
    Dim objMessage, objConfig
    strFrom = "forms@sophsoft.net"   'sender 
    strTo      = "dale_pusey@bat.com" 'recipient
    strSubject = "Consignment Note Submission"                  'email subject
    strBody    = "<html>
    
    <head>
    <meta http-equiv="Content-Language" content="en-gb">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>New Page 1</title>
    </head>
    
    <body>
    
    <p>&nbsp;<IMG src="http://www.psap.co.uk/psp3.gif">
    <address>
    &nbsp;</address>
    <address>
    	<font size="2"><span style="font-style: normal">Date: <b>ShowFormField("Date")</b></span></font></address>
    <address>
    	<font size="2"><span style="font-style: normal">Ref:ShowFormField("Reference")<b>&lt;&gt;</b></span></font></address>
    <address>
    &nbsp;</address>
    <address>
    	<font size="2">
    	<span style="font-style: normal; font-weight: 700; text-decoration: underline">
    	Shipper Information:</span></font></address>
    <address>
    	<font size="2"><span style="font-style: normal">Shipper Name:&nbsp;&nbsp;&nbsp;
    	<b>&lt;&gt;</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	</span></font>
    </address>
    <address>
    	<font size="2"><span style="font-style: normal">Shipper Address: <b>&lt;&gt;</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	</span></font>
    </address>
    <address>
    	<font size="2"><span style="font-style: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	<b>&lt;&gt;</b></span></font></address>
    <address>
    	<font size="2"><span style="font-style: normal">Shipper City:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	<b>&lt;&gt;</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	</span></font>
    </address>
    <address>
    	<font size="2"><span style="font-style: normal">Shipper P.Code:&nbsp; <b>&lt;&gt;</b></span></font></address>
    <address>
    	<font size="2"><span style="font-style: normal">Shipper Country:&nbsp; <b>&lt;&gt;</b></span></font></address>
    <address>
    	<font size="2"><span style="font-style: normal">Shipper tel:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	<b>&lt;&gt;</b></span></font></address>
    <address>
    &nbsp;</address>
    <address>
    	<font size="2">
    	<span style="font-style: normal; font-weight: 700; text-decoration: underline">
    	Consignee Information:</span></font></address>
    <address>
    	<font size="2"><span style="font-style: normal">Consignee Name:&nbsp;&nbsp;&nbsp;
    	<b>&lt;&gt;</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	</span></font>
    </address>
    <address>
    	<font size="2"><span style="font-style: normal">Consignee Address: <b>&lt;&gt;</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	</span></font>
    </address>
    <address>
    	<font size="2"><span style="font-style: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	<b>&lt;&gt;</b></span></font></address>
    <address>
    	<font size="2"><span style="font-style: normal">Consignee City:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	<b>&lt;&gt;</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	</span></font>
    </address>
    <address>
    	<font size="2"><span style="font-style: normal">Consignee P.Code:&nbsp; <b>
    	&lt;&gt;</b></span></font></address>
    <address>
    	<font size="2"><span style="font-style: normal">Consignee Country:&nbsp; <b>
    	&lt;&gt;</b></span></font></address>
    <address>
    	<font size="2"><span style="font-style: normal">Consignee tel:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	<b>&lt;&gt;</b></span></font></address>
    <address>
    &nbsp;</address>
    <address>
    	<font size="2">
    	<span style="font-style: normal; font-weight: 700; text-decoration: underline">
    	Consignment Details</span></font></address>
    <address>
    	<font size="2"><span style="font-style: normal">Dangerous Goods?&nbsp; <b>&lt;&gt;</b></span></font></address>
    <address>
    	<font size="2"><span style="font-style: normal">Documents:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	<b>&lt;&gt;</b></span></font></address>
    <address>
    	<font size="2"><span style="font-style: normal">Weight:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	<b>&lt;&gt;</b></span></font></address>
    <address>
    &nbsp;</address>
    <table border="1" cellspacing="0" cellpadding="0" width="553">
    	<tr>
    		<td width="167" align="center" bgcolor="#C0C0C0">
    		<address>
    			<span style="font-style: normal; font-weight: 700"><font size="2">
    			Description</font></span></address>
    		</td>
    		<td width="74" align="center" bgcolor="#C0C0C0">
    		<address>
    			<font size="2"><span style="font-style: normal; font-weight: 700">
    			Items</span></font></address>
    		</td>
    		<td width="80" align="center" bgcolor="#C0C0C0">
    		<address>
    			<font size="2"><span style="font-style: normal; font-weight: 700">
    			Weight</span></font></address>
    		</td>
    		<td width="77" align="center" bgcolor="#C0C0C0">
    		<address>
    			<font size="2"><span style="font-style: normal; font-weight: 700">
    			Length</span></font></address>
    		</td>
    		<td width="72" align="center" bgcolor="#C0C0C0">
    		<address>
    			<font size="2"><span style="font-style: normal; font-weight: 700">
    			Height</span></font></address>
    		</td>
    		<td align="center" bgcolor="#C0C0C0">
    		<address>
    			<font size="2"><span style="font-style: normal; font-weight: 700">
    			Width</span></font></address>
    		</td>
    	</tr>
    	<tr>
    		<td width="167" bgcolor="#EAF4FF">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="74" bgcolor="#EAF4FF">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="80" bgcolor="#EAF4FF">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="77" bgcolor="#EAF4FF">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="72" bgcolor="#EAF4FF">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td bgcolor="#EAF4FF">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    	</tr>
    	<tr>
    		<td width="167">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="74">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="80">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="77">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="72">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td>
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    	</tr>
    	<tr>
    		<td width="167" bgcolor="#E5EEFD">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="74" bgcolor="#E5EEFD">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="80" bgcolor="#E5EEFD">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="77" bgcolor="#E5EEFD">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="72" bgcolor="#E5EEFD">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td bgcolor="#E5EEFD">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    	</tr>
    	<tr>
    		<td width="167">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="74">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="80">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="77">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="72">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td>
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    	</tr>
    	<tr>
    		<td width="167" bgcolor="#E5EEFD">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="74" bgcolor="#E5EEFD">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="80" bgcolor="#E5EEFD">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="77" bgcolor="#E5EEFD">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td width="72" bgcolor="#E5EEFD">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    		<td bgcolor="#E5EEFD">
    		<address>
    			<font size="2" color="#FF0000"><span style="font-style: normal">&lt;&gt;</span></font></address>
    		</td>
    	</tr>
    </table>
    <address>
    &nbsp;</address>
    <address>
    	<font size="2"><span style="font-style: normal">Value for Customs: <b>&lt;&gt;</b></span></font></address>
    <address>
    &nbsp;</address>
    <address>
    	<font size="2">
    	<span style="font-style: normal; font-weight: 700; text-decoration: underline">
    	Special Delivery Instructions:</span></font></address>
    <address>
    	<font size="2"><span style="font-style: normal">&lt;&gt;</span></font></address>
    
    </body>
    
    </html>"          'email body (text)
    
    'Creation of the Email Server Object
    Set objMessage = CreateObject("CDO.Message")
    Set objConfig = CreateObject("CDO.Configuration")
    
    'Here is determined which way emails will be processed (local oder external
    'server). Please always set an external server.
    
    objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort
    
    'Outgoing SMTP server with SMTP authentication
    objConfig.Fields(cdoSMTPServer) = "auth.smtp.1and1.co.uk"
    
    'SMTP port
    objConfig.Fields(cdoSMTPServerPort) = 25
    'Plain text authentication
    objConfig.Fields(cdoSMTPAuthenticate) = cdoBasic
    
    'account name
    objConfig.Fields(cdoSendUserName) = "xxxx"
    
    'password
    objConfig.Fields(cdoSendPassword) = "xxxx"
    
    objConfig.Fields.Update
    
    Set objMessage.Configuration = objConfig
    objMessage.To        = strTo
    objMessage.From      = strFrom
    objMessage.Subject   = strSubject
    objMessage.HTMLBody  = strBody          'html mode
    
    On Error Resume Next
    objMessage.Send
    
    If Err.Number = "0" Then
      Response.Write("The message has been sent!")
    Else
      Response.Write("An error occured" & _
      "during sending.")
      response.write Err.Number & " " & Err.Description
      Err.Number = "0"
    End If
    %>
    does anyone know what i have done wrong?

    The email that is sent is formatted in html.

    the form can be viewed here

    no doubt the asp script looks terrible, i am new to asp and this is my first go so be gentle

    Thanks

    DP
    Last edited by DaleP85; 01-20-2005 at 10:39 PM.

  • #2
    New Coder
    Join Date
    Nov 2004
    Location
    Southampton, UK
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Please somebody help!

  • #3
    New Coder
    Join Date
    Aug 2003
    Location
    Shawnee Mission, Kansas
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    X-Send

    I have created a script that supports SMTP Authentication, you are free to use, all I ask is that you rate it.X-Send v1.3.3.25
    John Shepard
    Beyond The Impossible
    -----------------------------
    http://freeasphelp.tech.nu/
    FreeASPHelp by John Shepard
    Sign Up for a free account today!
    100% Free ASPHelp

  • #4
    New Coder
    Join Date
    Nov 2004
    Location
    Southampton, UK
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks dude, i will have a look when i get home and yeah i will rate ya
    im new to asp and im struggling to understand what the code means ect...

    DP

  • #5
    New Coder
    Join Date
    Nov 2004
    Location
    Southampton, UK
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Cheers for you help, i have sorted one part of it out with my own different script, but i have hit a snag that i dont know if anyone can help me.

    The script is fine as it sends the results to me, i receive them fine, and it shows a formatted page for the user to see and print off (with the submission details) but my problem is i am unable to format the submission so the email is received in HTML format.

    The send mail part is as follows:

    Code:
    Set Mail = Server.CreateObject("SMTPsvg.Mailer")
    Mail.FromName   = "123456"
    Mail.FromAddress= "someone@somewhere.com"
    Mail.RemoteHost = "xxx.xxxxxx.com"
    Mail.AddRecipient "123456", "someone@somewhere.com"
    Mail.Subject    = "xxxxxxx"
    Mail.Bodytext   = Request.Form("Date")
    Mail.Bodytext   = Request.Form("Reference")
    
    if Mail.SendMail then
     ' Response.Write "Your mail has already been sent..."
    else
     ' Response.Write "Mail send failure. Error was " & Mail.Response
    end if 
    %>
    and directly below that is the html for the page, is there a way/different command thing (sorry dont know the term im new to asp) so it will send a HTML formatted email? instead of just showing the "date" and "reference"?

    oh and btw it is in ASPmail, not sure if changing to CDOSYS would help? if so i dont know what i need to change????

    If you need to see the full script let me know.

    Cheers peeps

    DP

  • #6
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,072
    Thanks
    4
    Thanked 8 Times in 8 Posts
    You are working with a webserver here so you need to change from

    Set objMessage = CreateObject("CDO.Message")
    Set objConfig = CreateObject("CDO.Configuration")

    to this

    Set objMessage = Server.CreateObject("CDO.Message")
    Set objConfig = Server.CreateObject("CDO.Configuration")

    Also in asp 3.0 you use the request object to get the results from a form.
    so for your date use Request.Form("Date") - used on form method = post
    Request.QueryString("Date") - used on get method

    also Request.Form("Reference") instead of ShowFormField("Reference")


    Try that and let me know if it worked
    Last edited by miranda; 01-23-2005 at 08:03 PM.

  • #7
    New Coder
    Join Date
    Nov 2004
    Location
    Southampton, UK
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for your reply, i was refering to the script below the CDOSYS script, it uses ASPmail:

    here is the script again:

    Code:
    Set Mail = Server.CreateObject("SMTPsvg.Mailer")
    Mail.FromName   = "123456"
    Mail.FromAddress= "someone@somewhere.com"
    Mail.RemoteHost = "xxx.xxxxxx.com"
    Mail.AddRecipient "123456", "someone@somewhere.com"
    Mail.Subject    = "xxxxxxx"
    Mail.Bodytext   = Request.Form("Date")
    Mail.Bodytext   = Request.Form("Reference")
    
    if Mail.SendMail then
     ' Response.Write "Your mail has already been sent..."
    else
     ' Response.Write "Mail send failure. Error was " & Mail.Response
    end if 
    %>
    I need to know how i modify this code so it sends the results in HTML (me adding the required HTML) rather than just showing the following down the email:

    date
    reference
    ect...
    ect...

    thanks

    DP

  • #8
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    just make it format the body in html, ie if you want a bold you can do

    Mail.Bodytext = "<b>...sometext..</b><br>..somethingelse...laalla.." etc

  • #9
    New Coder
    Join Date
    Nov 2004
    Location
    Southampton, UK
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i have tried that before, it brings up an error 500, internal sever error, any ideas?

    Thanks
    DP

  • #10
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,072
    Thanks
    4
    Thanked 8 Times in 8 Posts
    There are Multiple errors. First off strings are enclosed in double quotes ". This tells the ASP Processor that the string is begining and ending. To show a double quote inside of the string " then you need to use two of them like so "". This way the ASP Processor knows that the string is not ending.

    Next, Do you have the aspmail COM component loaded and registered on the Server? If not then you will continue to create a 500 error.

    Last this code does not do what you are thinking it does.
    Mail.Bodytext = Request.Form("Date")
    Mail.Bodytext = Request.Form("Reference")


    Lets imagine the value of Date to be 1/24/2005 and the value of Reference to be widget

    Mail.Bodytext = Request.Form("Date") Would have sent an email with 1/24/2005 in it and nothing else. But you changed the value of Mail.BodyText to be widget so when the message is sent all that the body of the message will say is Widget. That is the entire message, nothing else including the html coding will be sent. Look up String Concatenation and what it is to understand what it does.

    To fix this you need to do the following.
    1) Check with your sys Admin or webhosting sysadmin to see if they have a COM Component for sending email or if they use CDO.
    2) change all double quotes in the body of the message to be two double quotes
    3) properly concatenate the Body string.

  • #11
    New Coder
    Join Date
    Nov 2004
    Location
    Southampton, UK
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks miranda, im new to asp so dont know about the stings ect.

    Its a webhosting companies server, it has ASPmail 3 installed (click here for the details) and also supports CDOSYS.

    It is annoying because i have tried everything i can think of to make it send an HTML format mail (with the results i in the mail, labeled and with some results in a table) but it just doesnt work for me, always comes up with a 500 error.

    I have tried to do it in CDOSYS but that hasnt worked either.

    this is what is ment to happen:

    1.User fills in the form
    2. users submits the form and is taken to a results page and the mail is sent.
    3. the user can print the results from there for their records.

    This maybe the problem:

    the page the results are displayed on is called mailer.asp, and at the top it has HTML, HEAD, BODY tags ect... then the code i mentioned in my earlier post, then it has the actual HTML for the results, some next to labels, some in a table ect... with the code <% - Request.Form("date") - %>
    or there abouts, it displays the results fine, there is no problem with that page but maybe i am just muckig up the aspmail script by doing this and causing the 500 errors whenever i change any of the following:

    Mail.Bodytext = Request.Form("Date")

    If i change it it brings up the error upon submission. i need to get it to display the results for the user and mail the results to be, both in the same HTML formatting.

    hope this makes sense

    DP

  • #12
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,072
    Thanks
    4
    Thanked 8 Times in 8 Posts
    I knew you were new to asp & programming when I saw this string.
    Code:
    strBody = "<html>
    
    <head>
    <meta http-equiv="Content-Language" content="en-gb">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>New Page 1</title>
    </head>
    
    <body>
    
    .......Trimmed for length.....
    </body>
    </html>"
    This is inteded as a single string of over 10800 characters in length!
    However, with each line break the string ends because it was not told to continue on. so you need to do something similar to what I have here.

    Code:
    Dim  strDate, strReference, strFrom, strTo, strSubject, strBody
    Dim objMessage, objConfig
    strDate = Request("Date") 
    strReference = Request("Reference") 
    strFrom = "forms@sophsoft.net"   'sender 
    strTo      = "dale_pusey@bat.com" 'recipient
    strSubject = "Consignment Note Submission"                  'email subject
    strBody    == "<html><head><meta http-equiv=""Content-Language"" content=""en-gb"">" & _
    "<meta http-equiv=""Content-Type"" content=""text/html; charset=windows-1252"">" & _
    "<title>New Page 1</title></head><body>" & _
    "<p>&nbsp;<IMG src=""http://www.psap.co.uk/psp3.gif"">" & _
    "<address>&nbsp;</address><address><font size=""2""><span style=""font-style: normal"">Date: <b>" & _
    strDate & "</b></span></font></address><address>" & _
    	"<font size=""2""><span style=""font-style: normal"">" & _
    	strReference & "<b>&lt;&gt;</b></span></font></address>" & _
        "<address>&nbsp;</address><address><font size=""2"">" & _
    	"<span style=""font-style: normal; font-weight: 700; text-decoration: underline"">" & _
    The ampersand & is known as a concatenation character. What it says is to append the preceding string with the info that follows. In the case of an ampersand followed by an underscore & _ it says add the next line to this one. Variables and VBScripting are not enclosed in double quotes. So you will see that the lines that begin with either a variable or some VBScripting do not start with the double quote, while all of the other lines do.

    So continue what I have done here and change these two lines
    Set objMessage = CreateObject("CDO.Message")
    Set objConfig = CreateObject("CDO.Configuration")

    to this
    Set objMessage = Server.CreateObject("CDO.Message")
    Set objConfig = Server.CreateObject("CDO.Configuration")

    Good Luck

  • #13
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try this link... it helped me a lot.

    http://www.powerasp.com/content/hintstips/asp-email.asp

  • #14
    New to the CF scene
    Join Date
    Feb 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Dale,

    I'm also with 1and1.co.uk and am having the same problem you were having (error '80040211') - could you please post the code you used that works - I've tried every possible thing, but am still getting this error...

    Here is the code I am using:

    Code:
    Dim objCDO
    Set objCDO = Server.CreateObject("CDO.Message")
    Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
    ' Outgoing SMTP server
    objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "auth.smtp.1and1.co.uk"
    objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'whether you use authentication on the server
    objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username"
    objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
    objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
    objCDOSYSCon.Fields.Update
    
    ' Update the CDOSYS Configuration
    Set objCDO.Configuration = objCDOSYSCon 
    
    objCDO.To = "anemailaddress"
    objCDO.From = "myemailaddress"	
    objCDO.Subject = "subject"
    
    bodyHTML = "my email code"
    			
    objCDO.HTMLBody = bodyHTML
    
    objCDO.Send
    Set objCDO = Nothing
    Set objCDOSYSCon = Nothing
    Can you see where I am going wrong?

    Many thanks,

    Peter
    Last edited by paliz; 02-14-2005 at 07:18 PM.

  • #15
    New to the CF scene
    Join Date
    Feb 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    Never mind...sorted it out - the code is correct, but 1and1.co.uk were having some mail problems, hence the error code from the server - all sorted now


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •