Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Knowledge Base

Post new topic   Reply to topic
Sending Mail with Attachments
View previous topic :: View next topic  
Author Message
andrew95
Newbie


Joined: 23 Mar 2004
Posts: 2

PostPosted: Mar 23rd, 2004 02:09 AM    Post subject: Sending Mail with Attachments Reply with quote

Just copy paste whats below and replace as needed

Dim path_name As String

Private Sub Form_Load()
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
End Sub

Public Sub Command1_Click()

Dim path_x as string

With cd1
InitDir = "C:\"
Filter = "All Files(*.*)|*.*"
ShowOpen
path_x = .FileName
End With

path_name = path_x

End Sub

Public Sub Command2_Click()

Dim find_char, i, x, j As Integer
Dim stratt_name As String

MAPIMessages1.Compose
MAPIMessages1.RecipDisplayName = txtto.Text
MAPIMessages1.MsgSubject = "Sending Mail from VB"
MAPIMessages1.MsgNoteText = "Hope u are feeling me"
MAPIMessages1.AttachmentPathName = path_name

For i = 1 To Len(path_name)

find_char = InStr(i, path_name, "\")
If find_char + 7 > Len(path_name) - 4 Then
GoTo stop_loop
End If
Next i
stop_loop:

x = find_char

stratt_name = Right(path_name, Len(path_name) - x)
MAPIMessages1.AttachmentName = stratt_name
MAPIMessages1.ResolveName
j = MsgBox("One message sent to : " & txtto & " with an attachment : " & stratt_name, vbInformation, "Message Sent")
'Send the mail message to the Recipient with an attachment
MAPIMessages1.Send

End Sub


Private Sub Form_Unload(Cancel As Integer)
MAPISession1.SignOff
Unload Me
End Sub
Back to top
View user's profile Send private message
ps2wizz
Newbie


Joined: 13 Nov 2003
Posts: 8
Location: Nottingham (England)

PostPosted: Mar 30th, 2004 05:54 AM    Post subject: what dose it do? Reply with quote

dude in english what dose this program do.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Knowledge Base All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic