Link to home
Start Free TrialLog in
Avatar of red_2
red_2

asked on

Sending e-mails from VB

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?
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jammyg
jammyg


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
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
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?

Avatar of red_2

ASKER

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.
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 : )
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
Avatar of red_2

ASKER

Hi sridhar_PJ

The link doesn't work!
Hi red_2,
This is problem with the site. No link is working in the site. Please try after some time.
Bye
Sridhar
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
Avatar of red_2

ASKER

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