...

View Full Version : ASP - CDOSYS mail script



DaleP85
01-20-2005, 10:37 PM
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:



<!--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 (http://psap.co.uk/cn.htm)

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

Thanks

DP

DaleP85
01-21-2005, 05:40 AM
Please somebody help! :)

freeasphelp
01-21-2005, 11:43 PM
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 (http://www.scripts.com/asp-scripts/email-scripts/xsend-v13325)

DaleP85
01-22-2005, 12:31 AM
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

DaleP85
01-23-2005, 08:42 AM
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:


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

miranda
01-23-2005, 07:58 PM
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

DaleP85
01-24-2005, 06:34 AM
thanks for your reply, i was refering to the script below the CDOSYS script, it uses ASPmail:

here is the script again:


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

ghell
01-24-2005, 03:47 PM
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

DaleP85
01-24-2005, 05:22 PM
i have tried that before, it brings up an error 500, internal sever error, any ideas?

Thanks
DP

miranda
01-24-2005, 09:15 PM
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.

DaleP85
01-26-2005, 08:55 PM
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) (http://www.serverobjects.com/comp/Aspmail3.htm) 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

miranda
01-27-2005, 01:54 AM
I knew you were new to asp & programming when I saw this string.


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.



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

oversoul
01-28-2005, 04:06 AM
try this link... it helped me a lot.

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

paliz
02-14-2005, 07:15 PM
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:



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

paliz
02-14-2005, 07:47 PM
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 :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum