Solved

Sending e-mails from VB

Posted on 2001-06-26
11
174 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
[X]
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
11 Comments
 
LVL 52

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

705 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