lalor dot net

mailto Commands

For event registration, it is ideal to have the recipient complete their details in a form that can be properly validated and collated in a database for easy administration of the attendees to the event as well their relevant details. The forms and databases can take some time to develop but ultimately are more efficient and effective in managing the administrative nightmares associated with events via a single repository of the information. Emailed RSVPs can sometimes be lost and hard to track in inboxes but for small events the mailto command can be modified to capture information.

Ultimately, the email RSVP can be fully modified by the sender and as such is not entirely reliable. Some older email clients and browsers cannot interpret the commands correctly again can be fully relied on. The other limitation is that the mailto: function is limited to 256 characters – so don’t go overboard with the subject or body text!

To quickly get an invitation email out without the need of a fully fledged registration system using forms and databases, we can add variables to the mailto: function in the href tag to automatically fill out an email messages’ Subject, and Body with the following code.

Generally an email link looks as follows:

[xml]<a href="mailto:email@domain.com">Email Me</a>[/xml]

If someone clicks on this, a new email message to email@domain.com will be opened. What if we wanted the person who clicked the email link to give us some information before they sent us the email, such as a custom Subject line so we know what the email is about, and if it was for an event maybe some details about themselves like their name, title and other information that is relevant to the event.

The link will need to be edited with the following mailto: commands.

Multiple recipients

Multiple emails can be separated by a comma:

[xml]mailto:one@domain.com,two@domain.com[/xml]

Subject

To specify a custom subject line you would specify the following after the last email address in the ‘mailto:’ field. ? is the first designator of options being used in the mailto: command

[xml]?subject=Custom Subject Line[/xml]

Carbon Copy (CC)

You can copy people in on the email as an FYI using &cc=. & is the designator of extra commands.

[xml]&cc=three@domain.com[/xml]

Blind Carbon Copy (BCC)

Again you can ’secretly’ have the email sent to another address. This however does not block the sender of the email to see the address.

[xml]&bcc=four@domain.com[/xml]

Body Text and Linefeeds

This text will automatically appear in the email body, but again the sender can change this. Linefeeds use the hex code %0A placed where you want the linefeed to occur.

[xml]body=Please complete your details below %0A
Name: %0A
Title: %0A
Company: %0A
Phone: %0A[/xml]

Generally I put the actual line feeds on their own separate line to help visualise what the email will look like.

Putting it all together

You may not need all of these components but as an example I will show the above altogether in a single piece of code. There are a couple of caveats that need to be known however.

  • The entire mailto: command must be within quotes
  • The ? must be the first option designator
  • All subsequent designator must be prefixed by the & symbol

[xml]<a href="mailto:one@domain.com,two@domain.com?subject=EVENT RSVP&cc=three@domain.com&bcc=four@domain.combody=Please complete your details below %0A
Name: %0A
Title: %0A
Company: %0A
Phone: %0A">Register for the Event</a>[/xml]

COMMENTS

add your thoughts