Solved

Sending e-mails from VB

Posted on 2001-06-26
11
168 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 49

Accepted Solution

by:
Ryan Chong earned 200 total points
Comment Utility
0
 

Expert Comment

by:jammyg
Comment Utility

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
Comment Utility
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
 
LVL 17

Expert Comment

by:inthedark
Comment Utility
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
Comment Utility
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 8

Expert Comment

by:glass_cookie
Comment Utility
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
Comment Utility
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
Comment Utility
Hi sridhar_PJ

The link doesn't work!
0
 
LVL 3

Expert Comment

by:sridhar_PJ
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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 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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now