INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Best modern way to automatically email reports

Best modern way to automatically email reports

(OP)
I want to automatically email a daily status report every might from a completely unattended computer.

Reading through the hundreds of old posts on this subject it seems most of them rely or routines written by others or external modules that exist in other programs (like Outlook) and there are troubles depending on which version you have and which OS you are using.

For instance I am using a freshly installed Windows 7 computer and there are no references or components for MAPI or Outlook. There is no email program installed on it so I haven't a default mail username or password.

Is there a way of using just Winsock alone by simply sending the right code sequence to an email server to achieve this?
It would seem there is but I can't find any documentation or examples of what data to send in the right order or format.
Maybe it needs to receive data back from the server before it can send the message?

It seems so munch easier to use someone else's routines that I suspect the basics have been forgotten but surely it only amounts to a few hundred bytes of data?

I tried the "free" EASendMail which appears to work fine but I suspect it is also sending something to someone else every time I use it as I got new spam straight after I tried it.

Any suggestions?

RE: Best modern way to automatically email reports

(OP)
I found it.
Seems very simple. Why people can charge 100s of dollars for a DLL I don't know.
Works perfectly without Outlook or MAPI

RE: Best modern way to automatically email reports

(OP)
One frightening aspect is I can send millions of emails through a SMTP server without having any username or password and using a fake Email address. This is probably how spammers do it.

RE: Best modern way to automatically email reports

>I can send millions of emails through a SMTP server without having any username or password and using a fake Email address

Not if the SMTP server is set up correctly.

>no references or components for MAPI or Outlook

Quite. But you don't need them. What you want to look for is the Microsoft CDO for Windows 2000 Library. Ships with all Windows OS from XP onwards. Note that it has nothing to do with earlier versions of CDO (e.g. 1.1, 1.2.1) or CDONTS. And we've provided examples of it in use in this forum on several occasions.

RE: Best modern way to automatically email reports

(OP)
Yes it sounds scary but true. and it is the second largest ISP in Australia, 100mhz cable.
The ability to use fake emails was an aside and is of no concern to me but I was hoping to use the minimum possible so down the track I had less chance of incompatibility.

Apparently this is quite common but I would guess it would not work on their mailo server if I was using a different ISP so they would know who was doing it.

I just sent it the correct data using a Winsock in the correct sequence and it worked. No MAPI or Outlook.

Is there something CDO can do that a plain Winsock can't do?

RE: Best modern way to automatically email reports

Windows has shipped with "CDO for Windows 2000" for a long time, i.e. starting with Windows 2000.

This will be far more versatile for SMTP sending than anything you can cobble up from raw TCP sockets. For example it has support for authentication and SSL that can be difficult to impossible to accomplish working down at the stone knives and bearskins level.

It is also trivial to use in a VB6 program. There are probably hundreds of threads here showing how to use it, some good and some pretty laughable.

RE: Best modern way to automatically email reports

>Is there something CDO can do that a plain Winsock can't do?

That's a bit like asking if there is anything VB6 can do that plain old assembler can't

RE: Best modern way to automatically email reports

Yea, I remember my instructor in Assembly Language 101, telling about the old programmer at Tandy, who retired and that they discovered all kinds of spaghetti code, some of which was self modifying code, ie instructions changed by the instructions.

Difference between can it be done vs should it be done. winky smile

RE: Best modern way to automatically email reports

If you want to use a modern method, one that will be forward compatible for more years than using CDO objects (which admitted are ubiquitous and simple to use still), is to use the .NET framework. There are built-in email objects to do exactly what you want, without referring to any external DLL calls. Any Windows OS will support the framework calls these days.
Look up the System.Net.Mail namespace.

You can use winsock to do such things, but it would require understanding SMTP protocol on a packet level and implementing your own from scratch. And IIRC, even using winsock requires using an external .ocx file.
As new Windows versions keep coming out, expect support for old COM APIs to start being dropped.

RE: Best modern way to automatically email reports

>without referring to any external DLL calls

In what way do you think cdosys.dll differs from system.dll as regards being an 'external' dll? The CDO for Windows 2000 library is as much part of the OS as the Framework, and is smaller. In addition, it is somewhat easier to use from VB61 which is what this forum is about (I'd happily accept your argument in favour of the System.Net.Mail namespace if we were discussing a .NET language)

>There are built-in email objects to do exactly what you want

Same goes CDO for Windows 2000


1some parts of the .NET framework are directly usable from VB6, such as system.io.stringwriter and system.collections.sortedlist, but not system.net.mail

RE: Best modern way to automatically email reports

>In what way do you think cdosys.dll differs from system.dll as regards being an 'external' dll?

That was perhaps worded clumsily. My point being that framework dlls are going to be supported for years to come, the future of legacy COM support is dubious. Which I suppose is irrelevant if you're forced to use it for some reason.

RE: Best modern way to automatically email reports

> the future of legacy COM support is dubious

Not really. It is there in all it's glory in W10, and that means Microsoft will be supporting it until at least 2025. I think its future is a little more sound than some people may give it credit for.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close