Solved

How to send though SMTP with Attachment ?

Posted on 2000-04-12
9
360 Views
Last Modified: 2013-11-13
I know how to send mails through SMTP. That is only doing it if Im sending text. How do I do send mail with Attachments like WAV files, Docs and other formats and the reciepient will still be able to decode/read it?
0
Comment
Question by:amrufon
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2706866
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2706871
sorry didnt read your question closely enough
0
 
LVL 2

Expert Comment

by:gelog
ID: 2706890
0
 
LVL 1

Expert Comment

by:detiege
ID: 2707283
You can try this code to send mail with attachment.
I think that's you want

Private Sub Command1_Click()
 
MAPISession1.SignOn
With MAPIMessages1
..MsgIndex = -1
..RecipDisplayName = "detiege@ceb.be"
' Recipient adress

..MsgSubject = "SUJET" ' Subject
..MsgNoteText = "Line 1" + vbCrLf + "Line 2"
' Message
..SessionID = MAPISession1.SessionID
           
..AttachmentIndex = 0
..AttachmentPathName = "C:\config.sys"
' File Path

..AttachmentPosition =
Len(.MsgNoteText) - 1
..AttachmentType = 0
..ResolveName
           
..AttachmentIndex = 1
..AttachmentPathName =
"C:\config.dos" ' File Path
..AttachmentPosition =
Len(.MsgNoteText) - 1
..AttachmentType = 0
..ResolveName
           
..Send
End With
MAPISession1.SignOff
 
End Sub
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:amrufon
ID: 2707457
Sorry, I have to reject this answer. It may be because the answer was incomplete. What I really need is how to send it WITHOUT USING MAPI.

I actually send the mail using WinSock. The only problem with using that is it treat everything as text. If you try to attach something to your mail and send it, the mail becomes garbage (the attached part that is).

Detigie, there is a bug in your solution. Your code will only work with Outlook Express. If you try using the same code and your MAPI app is Outlook, it would die with error the error "Unspecified Error has occured". To work around this, try padding an extra space after the message text.

Thanks anyway!

<grin>
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2708361
0
 
LVL 9

Accepted Solution

by:
Ruchi earned 200 total points
ID: 2708372
0
 
LVL 1

Expert Comment

by:adam8
ID: 2709923
0
 

Author Comment

by:amrufon
ID: 2710473
Thanks. I'll use the code as my foundation and build from it.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
This article will show, step by step, how to integrate R code into a R Sweave document
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

863 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

25 Experts available now in Live!

Get 1:1 Help Now