Emailing from a form

Posted on 1998-05-27
Last Modified: 2010-05-03
I have a form that updates a database and I need to send an email message telling me when that database
has been updated.  How do I do it?
Question by:thorner

Expert Comment

ID: 1461817
What are you using to email with?  Is this over an office LAN using an existing email package (MSMail, Lotus Notes).  If so, what type of mail package are you using?

Expert Comment

ID: 1461818
Assuming VB5...

Make sure you have checked the Microsoft MAPI controls under the Project menu.

Drag both the MAPI Session control and the MAPI Message control to your form.

I named my controls "mapSession" and "mapMessage"

add this to your Form_Load event:

Private Sub Form_Load()
End Sub

add this to your function:

With mapMessage
  .SessionID = mapSession.SessionID
  .RecipDisplayName = "Merritt, Jay"
  .MsgSubject = "Test"
  .MsgNoteText = "IT WORKED " & Chr(13)
  '.AttachmentPathName = "C:\Test.txt"
End With

since your signon is in the form_load, you can send multiple messages without signing on again.

have fun!

Author Comment

ID: 1461819
Okay, I messed up.  I forgot to say that it is for a VB-CGI application.  It's the usual submit form and all of that good stuff.  Sorry for the mix-up.
ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!


Author Comment

ID: 1461820
I already know how to do the database stuff.

Expert Comment

ID: 1461821
If you are using Microsoft SQL Server you can use xp_SendMail.

I've found it to be very easy.

Otherwise you need to be more specific your e-mail options.

Author Comment

ID: 1461822
I'm using an Access db with an O'reilly webserver.  I just want a dummy message sent.  The email message doesn't have to be anything special.  Is there perhaps a CGI command you know that will do this with VB?

Expert Comment

ID: 1461823
How do you send mail manually?

What kind of e-mail system do you have?

Author Comment

ID: 1461824
We use Pegasus mailer.  I don't know if you're familiar with that or not.

Expert Comment

ID: 1461825

Expert Comment

ID: 1461826
You need to use window existing build in program to "link" your database with the existing network or window program. Also you need to use pop-up function from clien/server network. Still confuse? You will get it over.

Accepted Solution

Zak031598 earned 20 total points
ID: 1461827

I found two ways to send mail using the Pegasus system.   The first and probably the
most reliable is to create a tmp file using the following format:

"From:" + strFrom + vbCrLf
"Date:"  Date$ + vbCrLf
"To:" + strName + vbCrLf
"Subject:" strSubject + vbCrLf
vbCrLf + vbCrLf

Then you can mail the file from a shell command using the Pegasus Exe with some
command line params.... I think that it is "WinPMail /f tmpMsg.txt"  I can get back to
you if this isn't correct.  I don't have PMail on this machine so I can't verify it.

The other way is to create the same file in the users PMail directory using a unique filename + .CNM.  The problem with this is that you need access to the PMail
directory.  The advantage to using this (or at least it was for me) is that by appending
to a single file such as DBUPDATE.CNM you will not get flooded with new mail


Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB error "Type mismatch" 2 55
Adding to a VBA? 6 72
Add a task in Outlook from access 11 41
MS SQL store procedure to calculate and return result 6 58
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

832 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