?
Solved

E-mail & visual basic forms

Posted on 2003-02-27
11
Medium Priority
?
165 Views
Last Modified: 2013-11-25
I created a from in visual basic.  When the user press submit, I want the program to send an e-mail to me containing all the info from the form.  Is it possible to do it, and if so how do I do it?  Is there some site where I can look at examples??

Thanks.
0
Comment
Question by:enigrini
11 Comments
 
LVL 27

Expert Comment

by:Dabas
ID: 8032516
Lets divide what you want to do into several parts:

1) You want the program to send you an email
2) You want the program to send the info on the form.

Are you having problems with both, or just one of them?

As to if it is possible to do, the answer is a definite yes!

Please be more specific though as to how the info is kept in the form. Textboxes only? Also comboboxes? Listboxes??

Dabas
0
 
LVL 18

Expert Comment

by:Sethi
ID: 8032536
The easiest and the most liked way in this forum for sending emails through VB is by using vbSendMail DLL that can be freely downloaded from this site:
http://www.freevbcode.com/ShowCode.Asp?ID=109

The other is using MAPI controls on VB. Look at the following links for tutorial and sample code of MAPI.
Use the following links to understand MAPI:
http://abstractvb.com/code/code713.asp
http://www.thescarms.com/vbasic/MapiEmail.asp

There are two other ways:
1.     CDO
2.     Outlook Objects
These two require certain applications like Microsoft Outlook or Exchange server to work efficeintly.
0
 
LVL 1

Expert Comment

by:tampabay420
ID: 8033116
if you know the user is going to have outlook, i'd suggest that- it's the easiest way to do it...

Sub SendMail(REC$, SUBJ$, BODY$)
    ' Tampa Bay  110100100
    ' Code written 5/08/02
   
    Dim myOutlook As Object
    Dim myMailItem As Object
    On Err GoTo endSendMail
    ' Make instance
    Set myOutlook = CreateObject("Outlook.Application")
    ' Make mail item
    Set myMailItem = myOutlook.CreateItem(0)
    ' Set recipient (internal mail)
    myMailItem.Recipients.Add REC$
    ' Set subject
    myMailItem.Subject = SUBJ$
    ' Set body
    myMailItem.HTMLBody = BODY$
    ' And send it!
    myMailItem.Send
    ' Close instance
    Set myOutlook = Nothing
    Exit Sub
endSendMail:
    MsgBox Error & vbNewLine & "Mail Was Not Sent!"
End Sub

if not outlook, then there are several ways to do it... mayb one way would be to insert an SMTP server into your program, kick start the mail server and use it to send the data to your address, you could possibly (you could also run an SMTP server from your house and use that one) , etc... again- there are many ways to go about this... give us a lil more info (and what kind of re$ources do you have?)
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:enigrini
ID: 8033441
I have textboxes and listboxes on the form.  I'm not 100% sure how to get the form to send me an email when the user submit it.  The user can use outlook or Exchange - there is no way of knowing what the users are using.

Thanks.
0
 
LVL 18

Expert Comment

by:Sethi
ID: 8033848
Have you downloaded vbSendMail DLL? If yes then register that DLL in your computer using regsvr32 "Path of the DLL" through Run Command.

After registering the DLL run the project example supplied with the DLL.

Now look into the code of the project example. What exactly you will be doing is that instead of giving an interface to the user, when the user clicks a command button on your form, the object of this dll will be created and will send the information you require to you.

In all the above methods remember one thing: the user will know that some information is being sent from the PC. There is no way you can hide it from the user. So if you have any such ideas, drop it.
0
 

Author Comment

by:enigrini
ID: 8040189
When I run my program I get the following error - can somebody maybe tell me what it means?

Compile error: User-dedined type not defined
& when you click on the help button - The msdn collection does not exist.

Thanks.
0
 

Author Comment

by:enigrini
ID: 8040348
tampabay420

I tried your code and it worked.  But what do I do if somebody uses exchange??
0
 

Author Comment

by:enigrini
ID: 8040829
tampabay420

I tried your code and it worked.  But what do I do if somebody uses exchange??
0
 

Expert Comment

by:CleanupPing
ID: 8947111
enigrini:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8983666
enigrini, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Refund points and save as a 0-pt PAQ.

DanRollins -- EE database cleanup volunteer
0
 

Accepted Solution

by:
YensidMod earned 0 total points
ID: 9104675
Question is PAQ'd and points refunded.

YensidMod
Community Support Moderator @Experts Exchange
0

Featured Post

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.

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…

621 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