?
Solved

Sending an email (or "saveable" message) WITHOUT an SMTP server?

Posted on 2005-05-10
23
Medium Priority
?
535 Views
Last Modified: 2008-02-01
Hello,
I'm looking to send emails (or a text message that can be saved) to personnel using Visual Basic. We have several test systems running that are programmed in Visual Basic. I would like to send a daily (or other timed) update to selected people. Currently, I use NET SEND and it pops up a message, but this message is easily cancelled, deleted, etc. An email would be more appropriate. I've sent emails in the past using an SMTP server and using the MAPI commands. I'm wondering if there is another way to do this without an SMTP service. The reason for this is that we use Lotus Notes on most of our PCs, but our test computers do not have (and we don't want it) any email clients on them. IS there another way to send an email without having to log in to an email server somewhere? We're using Windows 2000 or Windows XP on most of our systems. Also, we use VB6, but if necessary, can switch to VB.net.

Thanks!

jeff
0
Comment
Question by:jscharpf
  • 7
  • 6
  • 5
  • +2
23 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 13967561
Hi jscharpf,

http://www.freevbcode.com/showcode.asp?id=109

Is what you need, you can use this easily from VB and simply specify your smtp server address (your notes server) and use it to send emails internally (or externally depending on your notes smtp server configuration).

I have used it in a number of applications for exactly this purpose and it works time after time.

Tim Cottee
0
 
LVL 13

Expert Comment

by:softplus
ID: 13967581
Lots of ways !!
- VB.NET - send mails nativly or use the free version of EasyMail.NET ( www.quiksoft.com ) - or one of the many 3rd party solutions
- VB - use CDO (if on a server) or use a 3rd party solution like EasyMail ( www.quiksoft.com )
- Do it yourself with the winsock control ( if you like pain ;))

I would a) go with vb.net and try sending mails natively. If this is enough for you (still much better than net send), stick with it, otherwise go with a 3rd party solution based on your needs.
:)
0
 
LVL 13

Expert Comment

by:softplus
ID: 13967587
Just a note, you mention "without an smtp server" - you'll need one in any case. You need to place the emails somewhere so that the user can get them, for that you'll need an smtp server :). (or maybe I'm missing something again,need more coffee...)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 13967625
Hi,

See [Lotus_Notes/Q_20719143.html]">http://www.experts-exchange.com/Applications/Email/Lotus_Notes/Q_20719143.html]

Specificially (posted by "SPARTA"):

----------code sample----------
Sub SendMainOSLog()

Dim strSubject As String
Dim strDest As String
Dim strFilename As String

strDest = "oslog main"
strSubject = "Outstanding Confirmation Log For Asian Branches for week ending today"

    Dim Session As Object, DB As Object, Memo As Object
    Dim Server$, Mailfile$
    Dim Item As Object

    Set Session = CreateObject("Notes.NotesSession")  ' Creates a Notes Session
    Server$ = Session.GetEnvironmentString("MailServer", True)    ' Read the current mail server from Notes.ini
    Mailfile$ = Session.GetEnvironmentString("MailFile", True)    ' Read the current mail file from Notes.ini
    Set DB = Session.GetDatabase(Server$, Mailfile$)  ' Try to open the mail DATABASE

    If Not DB.IsOpen Then
        MsgBox "Could not access Notes mail file!  Please start Lotus Notes."    ' If Mail db not accessible, return an error
        Exit Sub
    End If

    Set Memo = DB.CreateDocument                      'Create a memo in the user's mail file
    Memo.Form = "Memo"                                'Set the form to be a mail Memo
    Memo.From = Session.UserName                      'Set the from field (not necessary)
    Memo.SendTo = strDest                             'Set the recipient of the Memo
    Memo.Subject = strSubject                         'Give the memo a Subject
   
    Set Item = Memo.CreateRichTextItem("Body")
    Call Item.EmbedObject(1454, "", "j:\fxops\asia\acm-ndf\chasing\OS Confo Log for Asian Branches.xls")      'Go to the body of the memo and embed the attachement
'   Call Memo.Save(True, False)                       'Save/don't save the memo
    Call Memo.Send(False, False)                      'Send the memo

    MsgBox "Main OS Confo Log sent"
   
End Sub
----------code sample----------

I do not have Lotus Notes installed to try this code, but it looks like to performs the function you need.

I would, however, remove the line:
    Call Item.EmbedObject(1454, "", "j:\fxops\asia\acm-ndf\chasing\OS Confo Log for Asian Branches.xls")      'Go to the body of the memo and embed the attachement


BFN,

fp.
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 13967640
Sorry, the URL I quoted was garbled as I added a "]" suffix:

Here it is without...

http://www.experts-exchange.com/Applications/Email/Lotus_Notes_Domino/Q_20719143.html

BFN,

fp.
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 13967678
fanpages,

No mail client will be installed on the machines in question, so that solution albeit a perfectly reasonable one won't work.

Tim
0
 
LVL 13

Expert Comment

by:softplus
ID: 13967703
ok, how about a different solution?
- setup: on the server, keep subdirectories per client or user (depending on how you want to send messages)
- have a client-software running on each workstation
- the client watches their subdirectory on the server
- the server can post a txt-file into the subdirectory with the message
- when the client notices the txt-file, it reads it, deletes it and displays it for the user. the user can copy+paste or dismiss the message, or save it locally (save as...)

Only problem (maybe) - you'll have to install the client-sw on each client workstation and it needs to run all the time (watching the subdirectory doesn't take much work though). Is this possible?
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 13968450
:)  Sorry Tim - yes, you're right; I read "test computer" as meaning whether the code would be tested.

Further to softplus' comment [is there an echo here this afternoon softplus? ;)]...

Why not use UDP via TCP/IP to exchange messages between your client machines?

Would you be adversed to installing dedicated applications on each machine so that messages could be sent directly to the required user?

This would be a little like Yahoo! Messager (etc.) in that the messages would not be able to be cancelled & would remain in a log if they were in the way immediately upon receipt.


BFN,

fp.
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 13968508
For "whether" read "where".  Oh dear...

For UDP, or other inter-process communications methods, please see (my) previous postings/contributions on the subject:

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21025872.html

BFN,

fp.
0
 

Author Comment

by:jscharpf
ID: 13970700
Thanks for all the answers.
I cannot install anything on the machines where the messages will be sent to. These will be personnel who have just an email client. I want to be able to send these notices either to their work email, or if possible, their home email.
Also, each test station (the computers that will be sending the emails) is a dedicated test machine that uses alot of recources. We had problems when we had email clients installed on these, so that is also not an option.
I have used Winsock (with the help of someone lol) before but only for sending messages, not emails.

I want to make sure I understand correctly, there is NO WAY to send an email without an SMTP service somewhere (ISP,etc.)?

Jeff

0
 
LVL 13

Expert Comment

by:softplus
ID: 13971234
Jeff - I'm not sure I (we) understand correctly - you mentioned above "No mail client will be installed on the machines in question" yet here "These will be personnel who have just an email client."? Do the workstations have or not have an email client? If so, where are they connecting to to get the email? This is where you will be sending the mails from the server (i.e. the server that sends messages uses the server that serves email to the workstations). If you are using a Lotus Notes server (as mentioned in the question), you can use the code from sparta, quoted by fanpages above (you will need the Lotus Notes objects, and possibly have to install a client on the server for this though).

If you do not want to use the Lotus Notes objects on the server itself, you can go the SMTP-way, i.e. send the mail for delivery to a SMTP-Server; the SMTP-Server will then relay it to the workstations (probably through the Lotus Notes server :)). I am not sure if you can use SMTP directly to Lotus Notes; if it has internet access (probably), then this should be possible. Looking here: http://www.wurd.com/cl_email_notes.php - it looks like it supports it from v4.6; In this case you can use SMTP directly to the Notes server, giving you something like this:

[Server-Generating-Messages] --- SMTP --- [Notes Server] --- LAN,etc --- [Workstations]
or
[Server-Generating-Messages] --- SMTP --- [SMTP-Server] --- WAN/LAN --- [Notes Server] --- LAN,etc --- [Workstations]

Using SMTP would also allow you to send your messages to any email-address, i.e. work or private. :)

Assuming SMTP will work (either to the Notes server directly or a 3rd Party SMTP relay to your Notes Server (i.e. your ISP)), you can now either use a DLL like TimCottee mentioned ( http://www.freevbcode.com/showcode.asp?id=109 ) or use a simple class wrapper for winsock (e.g. http://www.vbforums.com/printthread.php?t=334745 ). Both ways will allow you to send email-messages to a SMTP server. Does this make sense so far?

>I want to make sure I understand correctly, there is NO WAY to send an email without an SMTP service somewhere (ISP,etc.)?
Yes, this is mostly correct. The "standard" way of sending emails is by using the SMTP protocoll to a server. The server can then process the message and either pass it on (via SMTP) to the "home-server" of the user or store it locally, if the "home" of the user is on that server. There are exceptions to this :)) -- there are many other messaging protocols out there, but SMTP is standard on the internet (e.g. Exchange Servers either use SMTP to deliver to an internet address or use "their own" messaging protocolls to pass it to another Exchange server). I'm simplifying here, but it is more or less like this. If you want to send a mail directly to a Notes server, you can either use the "Notes-Messaging" (whatever that is) to get it there directly, or use SMTP to either pass it indirectly (i.e. via the SMTP-server your ISP provides) or directly to the server.
Roughly, it looks like this, for a general email user, who would send something to you behind the Notes server:
[User] --- SMTP --- [SMTP-Server at the users ISP] --- SMTP --- [possible relays] --- SMTP --- [Notes Server] --- LAN --- [Your workstations]
Note that the block [Notes Server] could also be split into a SMTP-Gateway and the Notes-Server; most likely this is done internally in Notes.

I hope I haven't sidetracked too much :))
0
 

Author Comment

by:jscharpf
ID: 13971634
Thanks softplus. :)
Let me clarify.

I have MANY PCs in a lab that are running tests. The test programs are all written in Visual Basic. None of these PCs have email clients on them. They are just PCs that run tests. In some cases, they're fully automated tests that run 24/7 without anyone touching them. In other cases, an operator may intervene (Imagine a test lab facility).  All of these PCs are in a remote location (it can be in a different building, town, or country), but all have access to our corporate network.

Now, at our main facility, we all have our own PCs at our desks (engineers, managers, etc.) each of us has access to Lotus Notes for email. We also have internet access, and network access.

My goal is to have some or all of the test computers send an email to one or more persons under one or more of the following conditions:

1) some event (test failure, etc.)
2) daily update of test status (test iterations, failures, etc.)

You see, our engineers don't want to walk out to the test PC and LOOK at the data, so we have to send it to them lol.. :)

Our corporate network is Novel, but we have a couple of MS domains somehow integrated into all that.. It gets a little more complicated because they've taken our "test lab" and given it it's own "Virtual Private Network". I don't know much about this, other than we somehow can get OUT of that network but nobody else can get IN so our test systems are protected. In any event, I don't know if that matters here, so I don't want to confuse things. lol..

so, maybe just forget about the previous paragraph lol..  

This is our situation. I was using MS Networking (messenger?) to send pop up messages. We just want to be able to send emails instead.

When I asked about the SMTP, I asked this because in the past I used a sample VB code which used MAPI. This worked great as long as I had a place to log in (Some email server somewhere?). Now  I don't know if that's possible.

Well, of course we have the corporate Lotus Notes email system, but do I need to have a NOTES client installed on my TEST PC in order to send an email to the Lotus Notes system? This is what I was asking about.


God, I hope this isn't getting more confusing.

I appreciate the time :)

Jeff


0
 
LVL 13

Expert Comment

by:softplus
ID: 13971866
ok, getting clearer :))
- MAPI: don't use this, it requires a client on the test-machine.
- Without a Notes client on the test machine, we're going to have to use SMTP (possibly better anyway)

So I would do it this way:
- Find a SMTP server you can use, i.e. that will allow mails from the test-machines in your lab and is able to pass them on to the email adress given.
- Once you have that, you can use one of the two SMTP methods I linked to, I'd use the class-wrapper for winsock, that way you don't have to install anything else. You certainly have a SMTP server somewhere in the company that will allow this, probably even especially available for this (i.e. other applications send mails as well, they have to go somewhere ;)). If not in the company, your ISP will be able to provide this (possibly at a cost) - with the security in your test-lab, I would however make sure you can get a VPN tunnel from the lab to the SMTP server and back to your company (no extra work on the programming side and the mails are kept secure).
- Now the test-machines should be able to send mails via SMTP to the SMTP server, from where they get passed on to your network (or to the home mail of the engineers)

Does that make sense? As soon as you have the SMTP server it should be easy to implement. You can actually already implement + test the code, using e.g. the SMTP server your private/home ISP provides (this is the same server you enter in Outlook for outgoing mails). :)
John
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 13972828
...obviously the ability to send e-mails to home/private e-mail addresses is depending on your Virtual Private Network allowing access outside of your organisation.

As an aside, do you need to know that tests have failed immediately, or could you batch results for notification to your designated e-mail contacts on a periodic basis (say, every few hours).

If so, you could log messages to a file within your VPN domain & periodically this file could be sent via MSN Messenger to a machine within your network that could then relay to external e-mail addresses (assuming that this 'gateway' machine was able to have client software installed upon it).

BFN,

fp.
0
 
LVL 6

Accepted Solution

by:
cjard earned 2000 total points
ID: 13976167

let me sense-check your question here:

You want to send an email, but you dont want to use a server that sends emails?
That's a bit like saying "i want to buy a car, but i dont want to go anywhere that sells cars"


If your organisation has email facilities, it must have an SMTP server. If you dont want to use MAPI, use CDO.. it's ridiculously easy:

Private Function sendEmail(commaSepEmailAddresses As String, attachmentName As String)
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML

Const cdoSendUsingPort = 2

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

Set Flds = iConf.Fields

' Set the CDOSYS configuration fields to use port 25 on the SMTP server.

With Flds
    .item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
    .item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = PUT YOUR MAIL SERVER IP OR HOST HERE
    .item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
    .item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic auth. may not be needed. if not, use 0
    .item("http://schemas.microsoft.com/cdo/configuration/sendusername") = PUT YOUR AUTHORISED USER NAME HERE
    .item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = PUT YOUR PASSWORD HERE
    .item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    .item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
    .Update
End With


' Apply the settings to the message.
With iMsg
    Set .Configuration = iConf
    .To = commaSepEmailAddresses
    .From = PUT YOUR EMAIL FROM ADDRESS HERE
    .Subject = PUT SOME TEXT HERE
    .HTMLBody = PUT SOME HTML HERE
    .AddAttachment attachmentName
    .Send
   
End With

' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing

End Function


if your smtp server requires auth, then you need to give it a username and password
look in outlook express (oir whatever) options for your sending-mail account. if it says "my smtp server requires auth" then you need auth.. otherwise its configured to allow anyone to conenct and send. in which case, auth mode is 0 and you DONT need to give your name and password. if in doubt ask your smtp server admin
0
 
LVL 6

Expert Comment

by:cjard
ID: 13976184
"I want to make sure I understand correctly, there is NO WAY to send an email without an SMTP service somewhere (ISP,etc.)?

Jeff"

absolutely impossible. how would you post a letter, if there were no letterboxes or post offices in your town?

even if you connected direct to their pop server and quoted all the necessary commands to form the email direct into their POP mailbox, then you would actually have written your own SMTP server. seeing as SMTP is an old wheel that has been done many times for free, its pointless reinventing it. If these people have email clients like Outlook Express, and they send each other emails, they MUST be using a SMTP server. to find out what it is, look in the account details (tools menu.. accounts.. mail... properties of an account.. servers tab)
0
 
LVL 6

Expert Comment

by:cjard
ID: 13976229
(actually, the above is a simplification of how email works; pop servers cannot accept emails, they store and deliver them when asked. the emails must get to that machine via smtp)

let me give you a quick run-down of how email works, basically:

you send an email
your outlook connects to your smtp server and says "here's an email, send it to bill@microsoft.com"
the smtp server looks and thinks "i dont know bill@microsoft.com, i'll pass it on to the next mail server who might know"
so it might look up the mail server at the destination organisation (microsoft.com) where bill works
then your smtp server connects to this microsofts smtp server and says "send this mail to bill@microsoft.com"
microsoft's smtp looks and sees "i know bill@microsoft.com, i'll put it in his maildrop reafdy for colelction"

the other scenario is where your mail server isnt allowed to go straight to microsoft's mail server, but must go via an upstream server. you dont know or care about this, your network admin guy does. in that case, your smtp conencts to the upstream and says "send this to bill@microsoft.com", and the upstream thinks "i dont know bill@microsoft.com" so it passes it on. maybe that upstream has an upstream..
your mail might go through 50, 100 smtp servers on its way.. it eventualy gets to an smtp that thinks "yes, i know this guy" and then it just gets dumped on that server hard disk. the pop service on the same machine waits for the user to conenct, then it passes the message down.

even if you wrote a program that dumps the mail directo on the hard disk in the pop store.. youve reinvented the smtp wheel. no need.. ;)
0
 
LVL 13

Expert Comment

by:softplus
ID: 13976300
>absolutely impossible. how would you post a letter, if there were no letterboxes or post offices in your town?
Actually, this is not quite the correct comparison - when sending email (i.e. electronic messages in general) there are many different systems/protocols available; SMTP is only ONE way (although the way most emails go). A better comparison would be: "how would you post a letter, if there were no FedEx offices in your town?" - the answer: "don't use FedEx" :))

Other "systems" for email transfer include Exchange, Microsoft Mail, Lotus Notes, Lotus cc:Mail, X.400, IBM PROFS, IBM SNADS, etc.; SMTP + X.400 are probably the most used though.

If you wanted to send one of these systems an email directly, you could do this without using SMTP at all, if you wanted to ;) - or if you had to. I.e. if he can't use SMTP from the lab to a SMTP-server, he might opt to use Notes to directly access the Notes server (but I don't think he wants to :)).
0
 

Author Comment

by:jscharpf
ID: 13977708
wow so many responses..

I appreciate all the time and thanks for being patient with me :)

I need a little time to re-read all this, and see if I can do something with all this information.

I will get back to this list in a few days.

Thanks again !

Jeff
0
 

Author Comment

by:jscharpf
ID: 13987636
Ok it's working!!! YEEHAA!! LOL..
I found our SmTP server address, and used the sample CDO code from cjard.
I didn't need a login, and I was able to give it a bogus "from" name such as "TesterPC1@fake.com"  and it worked great!


So I just have a few questions regarding this.
1) What exactly is CDO ? :)
2) Do I have to have those links to the microsoft website in the flds area? (With flds, item... etc..) in order for this code to work?

Thanks again!

Jeff
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 13989805
Sounds like those proposals offered without the use of SMTP are no longer required to be progressed.

If this is not the case, please indicate with a further comment.

Thanks.

BFN,

fp.
0
 
LVL 13

Expert Comment

by:softplus
ID: 13990212
1) what is CDO? http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_about_cdo_for_windows_2000.asp :)
2) If you reference the objects, you can do it like this:
    Set iConf = Server.CreateObject("CDO.Configuration")
    iConf.Fields(cdoSendUsingMethod) = cdoSendUsingPort
    iConf.Fields(cdoSMTPServer) = "smtp.your-isp.co.uk"
    iConf.Fields(cdoSMTPServerPort) = 25
    iConf.Fields(cdoSMTPAuthenticate) = cdoBasic
    iConf.Fields(cdoSendUserName) = "SuppliedByISP"
    iConf.Fields(cdoSendPassword) = "SuppliedByISP"

Just a note, for CDO, you will need to have the CDO objects installed on the lab computers (Cdosys.dll), according to MS it's an integral part of Windows 2000, probably XP as well, but not possible with Windows 98.

also, just because you can specify a fake sender now, doesn't mean it will stay that way ;) - try to get the guys running the SMTP server to contact you before they change anything in that respect :))
0
 

Author Comment

by:jscharpf
ID: 13991228
Yes, I apologize, it looks like we have an SMTP server so I can use it. Orginally I didn't know I had this option..

Anyway, you've all been helpful but cjard's worked right away so I will give that person the points.


Thanks again!

Jeff
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month16 days, 4 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question