Solved

Sending e-mails from VB

Posted on 2001-06-26
11
170 Views
Last Modified: 2010-05-02
I'm writing an Excel application that needs the ability to send out emails with attachments. The MailSystem object doesn't work (probably because I don't have Exchange), so I need another method. Is there a system call or something I can use?
0
Comment
Question by:red_2
11 Comments
 
LVL 50

Accepted Solution

by:
Ryan Chong earned 200 total points
ID: 6227605
0
 

Expert Comment

by:jammyg
ID: 6227629

In Vb use can use MAPI object. The Mapi control will interact with the mailing system. If you are intrested I can send you a sample application. Let me know.

Thanks
0
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6227801
You could try an API

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal
lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String,
ByVal nShowCmd As Long) As Long

Const SW_NORMAL = 1

sURL = "mailto:ChuckyCheese@PP.com"

ShellExecute hwnd, "open", sURL, vbNullString, vbNullString, SW_NORMAL
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 17

Expert Comment

by:inthedark
ID: 6227992
Are you creating an application which you hope to distribute to many companies, or just a one-off?

Are the email addresses pre-validated?

Will you be using Windows 2000, NT or Win 9x?

0
 

Author Comment

by:red_2
ID: 6228167
The MAPI object doesn't work (I don't have Outlook installed). I was hoping to do this without requiring Outlook, and be able to run it on both Win 9x and 2000,.

It will probably be a one-off application, but nevertheless I prefer to keep it as general as possible.

I also need to be able to get feedback from the system about whether the addresses are valid etc. (Thats why I can't use Blat, which otherwise fits perfect)

If nothing else works I'll use the MAPI system with Outlook, but I don't like to depend on other applications.
0
 
LVL 8

Expert Comment

by:glass_cookie
ID: 6228457
Hi!

Is this what you need:

View page...
http://www.planetsourcecode.com/vb/scripts/ShowCodeAsText.asp?txtCodeId=5946&lngWId=1
Description: This code will send email through MS Outlook 98, (or the most current version on your computer), using MS Excel 7.0 or higher.

Download...
http://www.planetsourcecode.com/upload/ftp/Email%20with187054222001.zip
Description: Email with attachments, Progress Bar, Drag & Drop

Download...
http://www.planetsourcecode.com/upload/ftp/CODE_UPLOAD2101.zip
Description: Email with attachments

Download...
http://www.planetsourcecode.com/upload/ftp/CODE_UPLOAD1778.zip
Description: This beta version of my networking component consists of two classes. The first "Email" sends email optionally with attachments encoded as base64 and compatible with the MIME 1.0 protocol. The other "Upload" allows for uploading of files through a web browser. Both were developed for use with Active Server Pages, but could be adapted for other uses as well.

Download...
http://www.planetsourcecode.com/upload/ftp/CDONTS%20Sen185814202001.zip
Description: CDONTS SendMail with attachment, (uploads attachment to webserver first!!!)

Download...
http://www.planetsourcecode.com/upload/ftp/CODE_UPLOAD3865382000.zip
Description: Write an e-mail client in no time! BuzMail is an 'overlay' to the MSMAPI controls provided with VB, in the form of a mail 'object' and various functions etc. It allows the user to send and receive e-mails with or without attachments without having to work out how to use the un-user friendly MSMAPI controls.

That's it!

glass cookie : )
0
 
LVL 3

Expert Comment

by:sridhar_PJ
ID: 6230051
Hi Red_2,
Try to use this client. It is very nice tool with full source code.
Have a look at it
http://www.freevbcode.com/ShowCode.Asp?ID=109
Bye
Sridhar
0
 

Author Comment

by:red_2
ID: 6230722
Hi sridhar_PJ

The link doesn't work!
0
 
LVL 3

Expert Comment

by:sridhar_PJ
ID: 6230916
Hi red_2,
This is problem with the site. No link is working in the site. Please try after some time.
Bye
Sridhar
0
 

Expert Comment

by:Huzaifa
ID: 6240612
Hi,
Use MAPI controls,
See the example on this link
http://visualbasic.about.com/compute/visualbasic/library/weekly/aa051401a.htm

let me know if u have any problems and i will help u
huz_52@yahoo.com

bye
0
 

Author Comment

by:red_2
ID: 6240756
Sorry for taking so long before accepting the answer. I tried different solutions, but in the end I ended up with using Outlook, so I'll give you the credit for being first
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

785 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