PHP mail : Include Onclick hyperlink inside email message

hi guys,

I’m having problem include an onclick hyperlink inside ‘message’ variable in PHP mail. The email can be send with no problem, it just the hyperlink wont open a new page once I click on it when I received the email. IF I use normal Link , the link can be open a new page with no problem. Thee reason I wanted to use onclick is I want the new page open in custom size once user click on the hyperlink inside email message.

I guess i’m having problem with ’ and " clause. I don’t know how to separate them if they’re in the same phrase.

My email message variable contains ’ '; clause and onclick hyperlink contains ’ and " clause. How do I handle the clause?

My code as below

**Note: Im using ‘LABEL’ as custom language output

////previous PHP code

$to = $supervisor_email;
$subject = ‘’.LABEL_EMAIL_SUBJECT.’’;
$message = ‘’.LABEL_EMAIL_MESSAGE.’


‘.LABEL_EMAIL_REQUESTOR.’: ‘.$user_fullname.’ (’.LABEL_EMAIL_HP_NUMBER.’: ‘.$user_hp_number.’)

‘.LABEL_EMAIL_LEAVE_TYPE.’: ‘.$the_leave_name.’

‘.LABEL_EMAIL_REASON.’: ‘.$leave_reason.’


‘.LABEL_EMAIL_START_DATE.’: ‘.$chosen_start_date.’

‘.LABEL_EMAIL_END_DATE.’: ‘.$chosen_end_date.’

‘.LABEL_EMAIL_NO_OF_DAYS.’: ‘.$num_of_days.’ ‘.LABEL_EMAIL_DAY.’

‘.LABEL_EMAIL_DURATION.’: ‘.$the_leave_duration.’








my web



$from = ‘[email protected]’;
$headers = ‘MIME-Version: 1.0’ . “\r\n”;
$headers .= ‘Content-type: text/html; charset=iso-8859-1’ . “\r\n”;
$headers .= ‘From:’ . $from;
///the rest of the code


Sponsor our Newsletter | Privacy Policy | Terms of Service