Results 1 to 9 of 9

Thread: Mailto: and attachments

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Posts
    8

    Mailto: and attachments

    Using mailto: protocol We can specify the address, the subject, and the body of
    a message but we cannot create an attachment.
    I could send an email from the server but that will
    require showing to the user all possible addresses to
    send that mail to.
    Instead I'd like to use client side because the user will
    be able to specify an address to send to from his local
    address book.
    So, how can I open new mail form on the client (Browser) and add an attachment?

    Thanks,
    Mark

  2. #2
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    NY
    Posts
    497
    Use MAPI http://support.microsoft.com/default...b;en-us;113033 or use Outlook Objects.

    Both are long journeys, requring lots of food, water, and installed ocx's or dll's.
    end war
    stop greed

  3. #3
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    You can add an attachment to the MailTo command using things like:

    & "&attach=" & Chr(34) & strFileName & Chr(34)

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Posts
    8
    But as far as mailto: goes it does not support attachment commands. Correct me if I am wrong.

  5. #5
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    I haven't tried it, but other people have, and they seem to feel that MailTo: does allow attachments, and they are specified as shown 2 posts above....

  6. #6

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Posts
    8
    This is my code. What is wrong with it?
    <A HREF="mailto:[email protected]?subject=Menu component feedback&body=test&attach=C:\test1.png">email</A>

  7. #7
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    This is how I would use it - from a VB program:
    VB Code:
    1. Declare Function ShellExecute Lib "shell32.dll" Alias _
    2.     "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation _
    3.     As String, ByVal lpFile As String, ByVal lpParameters _
    4.     As String, ByVal lpDirectory As String, ByVal nShowCmd _
    5.     As Long) As Long
    6.  
    7. Dim strAddress As String: strAddress = "[email protected]"
    8. Dim strSubject As String: strSubject = "Test E-Mail"
    9. Dim strBody As String: strBody = "This is a test. " & "Blah"
    10.    
    11. ShellExecute 0&, vbNullString, _
    12.        "mailto:" & strAddress & _
    13.         "?subject=" & strSubject & _
    14.         "&body=" & strBody, vbNullString, "C:\", vbNormal
    15.  
    16. 'Can also add an attachment using:
    17. '& "&attach=" & Chr(34) & strFileName & Chr(34)
    That shows that attachment names have " (Chr34) around them. Also, you may need more " in your example....

  8. #8
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    and MailTo works OK from a VB program, with an attachment.

    Maybe when called from a web page there is a restriction on the implementation of MailTo to prevent you sending any file from someone elses computer?

    Or maybe the web page can't see the local disk??

  9. #9

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Posts
    8
    This does not attach a file:
    <A id="id1" HREF="">email</A>
    <script>
    strFileName = "http://mgoldinxp/mailto/test1.png"
    document.all.id1.href = "mailto:[email protected]?subject=Menu component feedback&body=test" + "&attach=" + '"' + strFileName + '"'
    </script>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width