Results 1 to 8 of 8

Thread: [RESOLVED] How to add subject and attachments to mail.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2016
    Posts
    82

    Resolved [RESOLVED] How to add subject and attachments to mail.

    Hi everyone, I am trying to add "Subject" and "Attachment" to mail.

    Here is what I have so far. It opens winmail and adds the send address but not the subject.

    HTML Code:
    Public Class Form1
    
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            Process.Start("mailto:someone@gmail.com", "Subject:How to Add Subject and Attachments")
        End Sub
        
    End Class

  2. #2
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,474

    Re: How to add subject and attachments to mail.

    Try using the mailto: with a query string, something like
    Code:
    "mailto:someone@somewhere.com?subject=Here is a subject"
    should work.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2016
    Posts
    82

    Re: How to add subject and attachments to mail.

    Quote Originally Posted by PlausiblyDamp View Post
    Try using the mailto: with a query string, something like
    Code:
    "mailto:someone@somewhere.com?subject=Here is a subject"
    should work.
    Thank you very much, that works great, do you have any idea's on attaching a file by any chance.

  4. #4
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,399

    Re: How to add subject and attachments to mail.

    Most e-mail client software will not accept attachments from mailto: links.

    Possibly useful links:

    https://en.wikipedia.org/wiki/Mailto

    https://yoast.com/dev-blog/guide-mailto-links/

    https://forum.openoffice.org/en/foru...hp?f=9&t=86112

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Aug 2016
    Posts
    82

    Re: How to add subject and attachments to mail.

    Quote Originally Posted by jdc2000 View Post
    Most e-mail client software will not accept attachments from mailto: links.

    Possibly useful links:

    https://en.wikipedia.org/wiki/Mailto

    https://yoast.com/dev-blog/guide-mailto-links/

    https://forum.openoffice.org/en/foru...hp?f=9&t=86112
    Thanks for the reply, are you saying that attachments can Not be added to mailto:
    I found this code, but are not able to make it work for some reason

    HTML Code:
    mailto:mail@example.com?subject=Hello&body=Test&attachment=""C:\file.txt""

  6. #6
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,399

    Re: How to add subject and attachments to mail.

    What e-mail client are you actually using to process the mailto links? Most will not accept the attachment argument for obvious reasons (malicious spam). Some might, but they would need to be installed as the default mail client on your computer.

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,348

    Re: How to add subject and attachments to mail.

    The mailto protocol does support attachments but, as suggested, most email clients do not. Presumably it is a security measure, to ensure that sensitive files are not attached by applications without the user realising. What you're asking for is simply not possible. If you are using Outlook specifically and want to be able to add attachments programmatically then you can do so using Automation, as I mentioned in your other thread. If you are simply relying on the user's default email client, whatever that may be, then all you can do it include the attachment in the URL and let the user know that they need to attach the file manually if it gets ignored, which it almost certainly will.

    By the way, I have to wonder why you're asking how to set the subject here when I told you that you could do so using the mailto protocol and to search for information on that in your previous thread. Post #5 indicates that you did find some information online so why didn't you do that before posting this thread at all? You may still have had to ask about attachments given that they get ignored but you should have been able to set the subject for yourself. I just did a web search for "mailto protocol" and the very first result provided an example of setting the subject, so that's less than 30 seconds work to solve that problem.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Aug 2016
    Posts
    82

    Re: How to add subject and attachments to mail.

    Quote Originally Posted by jdc2000 View Post
    What e-mail client are you actually using to process the mailto links? Most will not accept the attachment argument for obvious reasons (malicious spam). Some might, but they would need to be installed as the default mail client on your computer.
    Thank you, My client, has Outlook, I have both Outlook and windows 10 email.

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