Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hoe do I Send EMail Attachements via Winsock ?

Status
Not open for further replies.

bjm1335

Programmer
Jan 25, 2002
44
US
In my error rtn I want to send a anon Email to the sysadmin that has a screen shot as an attachment. It looks like the easiest, cleanest, simplist way is via Winsock (Is it?). None of the examples I find on PSC show an attachment. Can I do it with Winsock alone. Do I have encode it or ???
Please share any code....
 
Hi,

hmm.. the only way i know is to do it though the "mapi" controls.

For that i have some code. (used it in app.)


Code:
'Send an Email using the users default email address.
    MAPISession1.SignOn
    MAPIMessages1.SessionID = Me.MAPISession1.SessionID
    MAPIMessages1.Compose
    MAPIMessages1.MsgSubject = Text2.Text
    MAPIMessages1.MsgNoteText = Create_EmailBody 
    'another sub.
    MAPIMessages1.RecipAddress = Text1.Text
    MAPIMessages1.ResolveName
    MAPIMessages1.AttachmentIndex = 0
    MAPIMessages1.AttachmentPosition = 0
    MAPIMessages1.AttachmentPathName = Label1.Caption  
    'The file you wish to attach the email.
    MAPIMessages1.AttachmentName = Label1.Caption 
    ' the name for the attachment.
    MAPIMessages1.Send
    MAPISession1.SignOff

Hope you can use it :D If you succeed then help others :D

ken Christensen
Christensenken@hotmail.com
 
The easiest and simplest way is through the use of the CDONTS Newmail object:

Code:
Dim myMail 
Set myMail = CreateObject("CDONTS.NewMail") 
myMail.From = "Example@microsoft.com" 
myMail.To = "Someone@microsoft.com" 
myMail.Subject = "Sample Message" 
myMail.Body = "This is a sample message." 
myMail.AttachFile "d:\sample.txt" 
myMail.Send 
Set myMail = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top