-
Oct 18th, 2018, 02:08 PM
#1
Thread Starter
Lively Member
[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
-
Oct 18th, 2018, 02:52 PM
#2
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.
-
Oct 18th, 2018, 03:15 PM
#3
Thread Starter
Lively Member
Re: How to add subject and attachments to mail.
Originally Posted by PlausiblyDamp
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.
-
Oct 18th, 2018, 03:54 PM
#4
Re: How to add subject and attachments to mail.
-
Oct 18th, 2018, 04:32 PM
#5
Thread Starter
Lively Member
Re: How to add subject and attachments to mail.
Originally Posted by jdc2000
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""
-
Oct 18th, 2018, 05:38 PM
#6
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.
-
Oct 18th, 2018, 06:07 PM
#7
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.
-
Oct 18th, 2018, 06:27 PM
#8
Thread Starter
Lively Member
Re: How to add subject and attachments to mail.
Originally Posted by jdc2000
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|