Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

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.
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.


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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to skip loop 6 62
String manipulation in Visual Basic 7 72
Add and format columns in vb6 7 63
Using an encrypted  value to decrypt and display contents in vb6 9 55
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

808 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