Emailing from a form

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?
Who is Participating?

Improve company productivity with a Business Account.Sign Up

Zak031598Connect With a Mentor Commented:

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

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?
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!
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

thornerAuthor Commented:
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.
thornerAuthor Commented:
I already know how to do the database stuff.
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.
thornerAuthor Commented:
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?
How do you send mail manually?

What kind of e-mail system do you have?
thornerAuthor Commented:
We use Pegasus mailer.  I don't know if you're familiar with that or not.
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.