Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drupal - use l or url function for mailto links

Does anyone know how to use the l() or url() function to create mailto links?

I am running drupal 6.

like image 966
Brian G Avatar asked Sep 22 '09 13:09

Brian G


2 Answers

You need to use the absolute option:

l('Mail me', 'mailto:[email protected]', array('absolute' => TRUE));

will generate

<a href="mailto:[email protected]">Mail Me</a>
like image 190
googletorp Avatar answered Sep 23 '22 22:09

googletorp


A good practice is to use the t() function with strings. Code should be then:

l(t('Mail me'), 'mailto:[email protected]', array('absolute' => TRUE));
like image 21
anou Avatar answered Sep 22 '22 22:09

anou