Discussion Locked

Send e-mail without CDONTS

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Tell us what you think about sending e-mail without CDONTS, as featured in this week's Web Development Zone newsletter.

7 replies

by jcb_brent

This is very helpful. Helps braoden our knowledge base and inprove our cevelopment capabilities.

by rez405

I am trying the code from the article that a friend send me and it is not working. I would like some help pls.
I have opened a new Activex dll project then in the class and the form added the coding as mentioned in the article.
It seem to me that there is something missing in the form module to call the function send_email in the class module.

I am running the project and i am not receiving any mail.

Is there something that i have missed.

Your help would be very appreciated. Thnx

by jerimorris

Hi,

I'm having problems too. It would have been helpful if the article had included an explanation of how to call the DLL.

I had to fix one or two problems before I could create the DLL. For example, I had to remove the hyphen in the function name SendE-mail. Otherwise, I created the DLL as described, and used REGSVR32 to register it. (I assume that's necessary.)

Then I created an HTML page that includes a form with the To, From, Subject, and Body, and that calls a sendmail.asp page when the form is submitted. My ASP uses the following to instantiate the object:

Set objNewMail = Server.CreateObject("mywinsockproj.mywinsockclass")

and there's no error resulting from that. (I know my error catching is working, because I misspelled the class name the first time around and it caught the error.)

The page uses the following to send the message:

ret = objNewMail.SendEmail ( _
Request.Form("txtTo"), _
Request.Form("txtFrom"_ Request.From("txtSubject"), _
Request.From("txtBody"), _
"00000")

I'm getting error 38, "Object doesn't support this property or method."

Any ideas?

MJ.

PS. In case it matters, I'm running NT 4.0 Workstation and PWS.

by jsperanza

Though I haven't tested this with respect to modifying the specific headers referred to in the article, CDONTS does, in fact, provide a method for modifying specific header info directly through its API. One accomplishes this via the .Value property of the object. An example would be:

Set objMail = CreateObject("CDONTS.Newmail")

' ASSIGN MAIL HEADER VALUES & FORMAT VALUES
With objMail
.MailFormat = cdoMailFormatMime
.BodyFormat = cdoBodyFormatHTML
.To = "someaddress@there.com"
.From = "someaddress@here.com"
.Value("return_path") = ""

' OR, FROM THE EXAMPLE (I DON'T BELIEVE THE
' "<" AND ">" SURROUNDING THE ID ARE REQUIRED
' BUT THIS CAN BE CONFIRMED BY REFERENCING ' THE SMTP PROTOCOL RFC DOCUMENTATION
.Value("message-id") = ""
.Subject = "Test"
.Body = "I can modify SMTP Headers!"
End With

There is an article somewhere in the MSDN knowledgbase on this...

Cheers.

by prasad007

This is ideal solution build emailing capabilities for applications. I used the code successfuly, however , I'm getting an error
when the program executes
SendData "QUIT"
The error says : incorrect connection status.
However the mail gets sent.

Any Ideas?

by phil_perkins_1

I'm not sure, but it may be that the SMTP server closed the connection before you got to the QUIT. This is just a guess off the top of my head. You could put an error handler in there to check your connection status when you issue a QUIT and if the connection is already closed, you could just ignore the error and continue (since the email is getting sent).

This discussion is closed to new replies.