|
-
Jun 2nd, 2003, 04:03 PM
#1
Thread Starter
Hyperactive Member
mailto: Attachment [Unresolved]
I'm using:
VB Code:
BodyData = "Please%20give%20a%20full%20description%20of%20the%20bug%20below%3A%0D%0A%0D%0A"
Attachment = "c:\autoexec.bat"
"?subject=" & Trim(App.Title) & "%20Bug%20Report" & _
"&body=" & BodyData _
& "&attach=" & Chr(34) & Attachment & Chr(34), vbNullString, vbNullString, SW_SHOWNORMAL
what's wrong? why doesnt the attachment attach??
Last edited by HAVocINCARNATE29; Jun 2nd, 2003 at 10:20 PM.
______________
-
Jun 2nd, 2003, 10:19 PM
#2
Thread Starter
Hyperactive Member
-
Jun 3rd, 2003, 12:16 AM
#3
Lively Member
hmm to me it looks you re just attaching a string not a file;
U have outlook ?
VB Code:
Sub OutlookNewMessage()
Dim olMail As MailItem
Set olMail = Application.CreateItem(olMailitem)
With olMail
.Subject = "Beergarden"
.Body = "Meet you there"
.attachments.Add _
Source:="C:\Beer.jpg"
.Display
End With
End Sub
Things are not happening to you, things are happening because of you!
-
Jun 3rd, 2003, 06:35 AM
#4
Frenzied Member
Does ShellExecute and the MailTo functionality allow attachments? I thought it only allowed parameters of MailTo, cc, bcc, Subject and body. See Knowledge Base 188019 on MS site.
-
Jun 3rd, 2003, 01:09 PM
#5
Thread Starter
Hyperactive Member
First thing, i'm try to make this independent of any specific email client, so i dont want to use outlook specific code.
this example i found implys that you can attach a file...
VB Code:
Option Explicit
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
Private Const SW_SHOWNORMAL = 1
Private Sub SendMail(lhWnd As Long, Optional Address As String, _
Optional Subject As String, Optional Body As String, _
Optional CC As String, Optional bcc As String, Optional Attachement As String)
'*********************************************************
'******** ********
'******** bygger opp en e-post melding, og sender ********
'******** denne ved å benytte default mail system ********
'******** ********
'******** NB!! Attachement fungerer KUN med ********
'******** Outlook og outlook express ********
'******** ********
'*********************************************************
Dim strCommand As String
'bygger opp "mail-strengen"
If Len(Subject) Then strCommand = "&Subject=" & Subject
If Len(Body) Then
Body = Replace(Body, "&", "%26")
Body = Replace(Body, " ", "%20")
Body = Replace(Body, vbCrLf, "%0D%0A")
Body = Replace(Body, vbCr, "%0D")
Body = Replace(Body, vbLf, "%0A")
strCommand = strCommand & "&Body=" & Body & "%0D%0A"
End If
If Len(CC) Then strCommand = strCommand & "&CC=" & CC
If Len(bcc) Then strCommand = strCommand & "&BCC=" & bcc
If Len(Attachement) Then strCommand = strCommand & "&Attacth=" & Chr(34) & Attachement & Chr(34)
'passer på at første tegn er et ?-tegn
If Len(strCommand) Then
Mid(strCommand, 1, 1) = "?"
End If
'legger til teksten "mailto:" og hoved adresse
strCommand = "mailto:" & Address & strCommand
'Starter default mail program v.h.a shellexecute
Call ShellExecute(lhWnd, "open", strCommand, _
vbNullString, vbNullString, SW_SHOWNORMAL)
End Sub
Private Sub Command1_Click()
End Sub
-
Jun 3rd, 2003, 01:58 PM
#6
PowerPoster
Well
The code you posted should send thefilename sent. Does it not work?
If not, are you sure it's a valid file?
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Jun 3rd, 2003, 02:01 PM
#7
Hyperactive Member
Not sure if this will help....but found it when I was searching for close to the same thing awhile back.
Not the author, so cant take the credit.
Private Sub cmdEmail_Click()
Dim emailstuff As String
emailStuff = App.Path & "\file.mdb"
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.Compose
MAPIMessages1.RecipAddress = "[email protected]"
MAPIMessages1.AttachmentPathName = emailStuff
MAPIMessages1.ResolveName
MAPIMessages1.MsgSubject = "Place subject here"
MAPIMessages1.MsgNoteText = "Place message here"
MAPIMessages1.Send False
MAPISession1.SignOff
End Sub
Hope it helps....
-
Jun 3rd, 2003, 02:22 PM
#8
Thread Starter
Hyperactive Member
To answer the questions:
James Stanich: The path is a valid filepath, but its still doesnt attach. I have also tryed changing the code from "Attacth=" to "Attach=" but that didnt help either.
VB4fun: What component / Reference do i need to add to use MAPISession?
thanks for all the help so far!
-
Jun 3rd, 2003, 02:34 PM
#9
PowerPoster
Well
Try changing to attachement.
You need to add the MAPI controls to your project. If you post your email, I can send you a sample project (too large to load here)
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Jun 3rd, 2003, 02:38 PM
#10
Hyperactive Member
Project|Components|Microsoft MAPI Controls 6.0
-
Jun 3rd, 2003, 02:52 PM
#11
PowerPoster
I use a free add-in called "HTML Mailer". You can download it from the web. It works great and it's free.
-
Jun 3rd, 2003, 11:11 PM
#12
Thread Starter
Hyperactive Member
Thank for the help so far!
My email is
havocincarnate29
@prontomail.com
-
Nov 24th, 2003, 04:58 AM
#13
Hyperactive Member
It is the mark of an instructed mind to rest satisfied with the degree of precision which the nature of the subject admits, and not to seek exactness when only an approximation of the truth is possible.
-Aristotle As quoted in Rapid Development, chapter 8, page 167.
-
Nov 24th, 2003, 05:17 AM
#14
-= B u g S l a y e r =-
Originally posted by HAVocINCARNATE29
First thing, i'm try to make this independent of any specific email client, so i dont want to use outlook specific code.
this example i found implys that you can attach a file...
VB Code:
Option Explicit
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
Private Const SW_SHOWNORMAL = 1
Private Sub SendMail(lhWnd As Long, Optional Address As String, _
Optional Subject As String, Optional Body As String, _
Optional CC As String, Optional bcc As String, Optional Attachement As String)
'*********************************************************
'******** ********
'******** bygger opp en e-post melding, og sender ********
'******** denne ved å benytte default mail system ********
'******** ********
'******** NB!! Attachement fungerer KUN med ********
'******** Outlook og outlook express ********
'******** ********
'*********************************************************
Dim strCommand As String
'bygger opp "mail-strengen"
If Len(Subject) Then strCommand = "&Subject=" & Subject
If Len(Body) Then
Body = Replace(Body, "&", "%26")
Body = Replace(Body, " ", "%20")
Body = Replace(Body, vbCrLf, "%0D%0A")
Body = Replace(Body, vbCr, "%0D")
Body = Replace(Body, vbLf, "%0A")
strCommand = strCommand & "&Body=" & Body & "%0D%0A"
End If
If Len(CC) Then strCommand = strCommand & "&CC=" & CC
If Len(bcc) Then strCommand = strCommand & "&BCC=" & bcc
If Len(Attachement) Then strCommand = strCommand & "&Attacth=" & Chr(34) & Attachement & Chr(34)
'passer på at første tegn er et ?-tegn
If Len(strCommand) Then
Mid(strCommand, 1, 1) = "?"
End If
'legger til teksten "mailto:" og hoved adresse
strCommand = "mailto:" & Address & strCommand
'Starter default mail program v.h.a shellexecute
Call ShellExecute(lhWnd, "open", strCommand, _
vbNullString, vbNullString, SW_SHOWNORMAL)
End Sub
Private Sub Command1_Click()
End Sub
hmm those comments are mine... 
attachment part will only work for outlook, not outlook express...
-
Nov 24th, 2003, 08:40 AM
#15
Hyperactive Member
It is the mark of an instructed mind to rest satisfied with the degree of precision which the nature of the subject admits, and not to seek exactness when only an approximation of the truth is possible.
-Aristotle As quoted in Rapid Development, chapter 8, page 167.
-
Nov 25th, 2003, 01:11 PM
#16
Hyperactive Member
Re: mailto: Attachment [Unresolved]
Originally posted by HAVocINCARNATE29
I'm using:
VB Code:
BodyData = "Please%20give%20a%20full%20description%20of%20the%20bug%20below%3A%0D%0A%0D%0A"
Attachment = "c:\autoexec.bat"
"?subject=" & Trim(App.Title) & "%20Bug%20Report" & _
"&body=" & BodyData _
& "&attach=" & Chr(34) & Attachment & Chr(34), vbNullString, vbNullString, SW_SHOWNORMAL
what's wrong? why doesnt the attachment attach??
http://www.lencom.com/desc/indexN3946.html
It's simple little exe file .. but does the job ........
It is the mark of an instructed mind to rest satisfied with the degree of precision which the nature of the subject admits, and not to seek exactness when only an approximation of the truth is possible.
-Aristotle As quoted in Rapid Development, chapter 8, page 167.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|