473,394 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

problems with sending email

i am a newbie to asp
i wrote the following asp code to send email

<%
Set objCDOMessage = Server.CreateObject("CDO.Message")
'creates the object
objCDOMessage.From = "me@mydomain.com"
objCDOMessage.To = "you@yahoo.com"

objCDOMessage.Subject = "blah blah"

objCDOMessage.Body = "Thanks for taking the time blah blah....."

'now send the message
objCDOMessage.Send
'wrap things up
Set objCDOMessage = Nothing
%>


this is not working,
should i configure any other stuffs

plz help me...............
Jul 29 '06 #1
4 3522
sashi
1,754 Expert 1GB
Hi there,

i have attached some sample code segment below.. give it a try.. it works fine for me and hope it works ok for you too.. take care..

Expand|Select|Wrap|Line Numbers
  1. Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory. 
  2. Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network). 
  3.  
  4. Const cdoAnonymous = 0 'Do not authenticate
  5. Const cdoBasic = 1 'basic (clear-text) authentication
  6. Const cdoNTLM = 2 'NTLM
  7.  
  8. Set objMessage = CreateObject("CDO.Message") 
  9. objMessage.Subject = "Example CDO Message" 
  10. objMessage.From = """Me"" <me@my.com>" 
  11. objMessage.To = "test@paulsadowski.com" 
  12. objMessage.TextBody = "This is some sample message text.." & vbCRLF & "It was sent using SMTP authentication."
  13.  
  14. '==This section provides the configuration information for the remote SMTP server.
  15.  
  16. objMessage.Configuration.Fields.Item _
  17. ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
  18.  
  19. 'Name or IP of Remote SMTP Server
  20. objMessage.Configuration.Fields.Item _
  21. ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.your.com"
  22.  
  23. 'Type of authentication, NONE, Basic (Base64 encoded), NTLM
  24. objMessage.Configuration.Fields.Item _
  25. ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
  26.  
  27. 'Your UserID on the SMTP server
  28. objMessage.Configuration.Fields.Item _
  29. ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "youruserid"
  30.  
  31. 'Your password on the SMTP server
  32. objMessage.Configuration.Fields.Item _
  33. ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "yourpassword"
  34.  
  35. 'Server port (typically 25)
  36. objMessage.Configuration.Fields.Item _
  37. ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
  38.  
  39. 'Use SSL for the connection (False or True)
  40. objMessage.Configuration.Fields.Item _
  41. ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
  42.  
  43. 'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
  44. objMessage.Configuration.Fields.Item _
  45. ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
  46.  
  47. objMessage.Configuration.Fields.Update
  48.  
  49. '==End remote SMTP server configuration section==
  50.  
  51. objMessage.Send
  52.  
Jul 29 '06 #2
Thanx its working!!!
Aug 1 '06 #3
menon
4
Hi Guys!

Use CDONTS instead of CDO Message Sending,
Here is the sample code for sending CDONTS HTML Mails!

'Code Begins

Dim objCDOMail

'Create the e-mail server object
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")

objCDOMail.From = Request.Form("email")
objCDOMail.To = "info@yourdomain.com"
objCDOMail.Subject ="Enquiry From yourdomain.com"

objCDOMail.BodyFormat = 0 'Set the e-mail body format (0=HTML 1=Text)
objCDOMail.MailFormat = 0 'Set the mail format (0=MIME 1=Text)

'Set the main body of the e-mail
objCDOMail.Body = " "& vbNewLine & _
"<p><font size=""2"" face=""Verdana"">Enquiry From Website</font></p>"& vbNewLine

objCDOMail.Importance = 1 'Importance of the e-mail (0=Low, 1=Normal, 2=High)
objCDOMail.Send 'Send the e-mail

Set objCDOMail = Nothing 'Close the server object

'Code Ends

best regards,
Kalipurayath Sanal Menon
Aug 8 '06 #4
hi guys.. i know this reply is quite late for this topic. but im desperate. i need to get my project done ASAP.

here goes..

i used CDO technology to send html-format emails using asp. everything works fine but the problem is when the email is received by the recepient, some tags are broken e.g </tr> -- < /tr> causing this tag to display in the browser. and worst there are some double spaces created between tags making my layout totally destroyed.. my page is a dynamic page with lots of queries from a mssql2005 DB. i tried displaying first the html value to the browser and it looks fine. but when it appeared in an email, its the exact opposite.

please help me. i badly need it. ive been looking for help anywhere.. havent found one yet. i would really appreciate your help guys...

regards,
richard
Mar 28 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: dan glenn | last post by:
I'm creating HTML emails from a PHP site and sending them out to an email list (just about 40 people so far are on this list). I've tested and confirmed that these emails work in yahoo.com's...
0
by: Nitec Dev | last post by:
Our setup: server1 ASP database running on IIS5, Outlook 2000 and SQL 2000 on Windows 2000. Server2 runs Windows 2000 with Exchange 2000 using CDO 1.2 MAPI Sessions. Clients use IE5/6 and had...
9
by: tshad | last post by:
This is a problem that we saw before on our asp site, but don't know how to fix it. We are seeing it on our .net site also. We have our email sending from our Windows 2003 server with exchange...
2
by: Tim V. | last post by:
Here's the layout: AIX v5.2, DB2 v8 fp8 running in 64bit I've got a Multi-partitioned db running on lpar4 and I want to connect it to 2 instances running on lpar13. We'll deal with just 1...
1
by: shots86 | last post by:
I am having problems sending emails via the CDO.Message object from an ASP script which was working fine. On the server I can still send emails via the CDO.Message from a .vbs script executed on...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
3
by: armando perez | last post by:
Hi, this is my first time here, but I was looking for something that may help me, and still, I haven't found something to use. I'm using a website made in .NET with C#, when I'm running my site...
2
by: oliu321 | last post by:
Hi, First I am not trying to write a client to talk with hotmail straightly. I am trying to write some codes to send emails through a SMTP server. I wrote a C++ version using pure socket...
71
by: desktop | last post by:
I have read in Bjarne Stroustrup that using malloc and free should be avoided in C++ because they deal with uninitialized memory and one should instead use new and delete. But why is that a...
5
by: Dave | last post by:
Hi All, I'm experiencing problems with sending mail using mail() to forwarded email accounts. The problem seems to revolve around the optional 4th argument of mail(), namely 'additional headers'....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.