Passing a URL in an email


Well-known member
Hi, I'm creating a mod that sends a user an email

Within this email, a url is sent:

public function sendLoginKeyEmail(array $user, $key)
        $link = XenForo_Link::buildPublicLink('full:login', $key, array('key' => $key));
            $mailParams = array(
                'user' => $user,
                'subject' => "login_security_link",
                'boardTitle' => XenForo_Application::get('options')->boardTitle,
                'message' =>
                "Some one has tried to log in to your account from an ip address not associated to your Login Security \n".
                "Sent from IP Address: \n".
                "If this was you, you can log-in using this temporary link: \n".
                "<a href='".$link."'>".$link."</a>"
            $mail = XenForo_Mail::create('contact', $mailParams, 0);
                $user['email'], // $toEmail
                $user['username'], // $toName
                    'Sender' => XenForo_Application::get('options')->contactEmailAddress // $headers
                XenForo_Application::get('options')->contactEmailAddress,  // $fromEmail
                XenForo_Application::get('options')->boardTitle, // $fromName
                XenForo_Application::get('options')->contactEmailAddress // $returnPath

The text is hard coded while I test it, they will be turned into phrases

The question I have is that I wondered if anyone has managed to pass a URL as a link within an email using a similar method to the above. Right now, I'm finding the email message comes out as:

If this was you, you can log-in using this temporary link:
<a href='http://'>http://</a>

It's not essential to have an active link, but it would be nice
Strange, if I use this:

$mail = XenForo_Mail::create('MAIL_CONTAINER', $mailParams, 0);
$mail = XenForo_Mail::create('contact', $mailParams, 0);
or this:
$mail = XenForo_Mail::create('conversation_insert_messagetext', $mailParams, 0);

They all seem to get sent with the "contact" email template

I've seen that the conversation template passes urls (and that the contact email sent doesn't) so I was hoping to piggy back the conversation templates... but alas, using the above, all get sent as contact templates... (The following message has been sent from user1 <mail> via the contact form at xxx.)

Does anyone have experience with this?
I was being dumb, they do update and send the correct templates
... okay, now its just a matter of creating my own email template similar to the converstaion email templates (that seem to pass the url)...

and then sending it with the method above...
Top Bottom