I have used HTML links before with the href set to mailto:address@blah.com, which always work a treat. Today though needed the same functionality as a straightforward mailto link but via an onclick event of a DIV I'm using as a button.
Not difficult once you know how, and I also found out a couple of neat new tricks for populating the mail client with values.
All the onclick code requires is:
onclick="self.location = 'mailto:help@selfhelpsupemarket.com'"
Not difficult once you know how, and I also found out a couple of neat new tricks for populating the mail client with values.
All the onclick code requires is:
onclick="self.location = 'mailto:help@selfhelpsupemarket.com'"
Simply append to the mailto: email address a query string using cc, bcc, subject and or body fields to pre-populate the client mail message with the appropriate fields filled. All the fields are optional so you only need to use the fields appropriate to your task. All fields and values need to be separated with ampersand.
A couple of examples:
mailto:steve@t.com?subject=hello from website&cc=info@test.com
So create a new email to be sent to steve@t.com, cc'd to info@t.com with a subject of hello from website.
mailto:steve@t.com?subject=hello from website&body=Dear Steve,
This one will create a new message again to steve@t.com with the same subject but the message body is started with Dear Steve.
No comments:
Post a Comment