• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 181
  • Last Modified:

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?
0
red_2
Asked:
red_2
1 Solution
 
jammygCommented:

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
 
Dave_GreeneCommented:
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!

 
inthedarkCommented:
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
 
red_2Author Commented:
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
 
glass_cookieCommented:
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
 
sridhar_PJCommented:
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
 
red_2Author Commented:
Hi sridhar_PJ

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

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now