[SOLVED] Mail with link not sent

the mail() function

Moderators: egami, macek, gesf

Post Reply
Magogan
New php-forum User
New php-forum User
Posts: 1
Joined: Tue Apr 03, 2018 12:57 pm

Tue Apr 03, 2018 1:06 pm

Hi,

I have a virtual server running Ubuntu and I send mails via an email account from my webspace provider (using ssmtp). So far, I have successfully sent mails, but as soon as I include a link in the mail, it never arrives.

Code: Select all

//message with link, not working
$message="<!DOCTYPE HTML><html>
        <head>
        <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
        </head>
        <body>
        Dear $name,<br><br>thank you for creating a ****** Account. Please click the link below to confirm your email address.<br><br><a href='https://example.com/account/verifyemail/".$token."'>https://example.com/account/verifyemail/".$token."</a>
        </body>/html>";
    //message without link, working without any problem
    $message="<!DOCTYPE HTML><html>
        <head>
        <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
        </head>
        <body>
        Dear $name,<br><br>thank you for creating a ****** Account. Please click the link below to confirm your email address.
        </body></html>";
    
    $headers = "Content-type:text/html;charset=UTF-8" . "\r\n";
    $headers .="From: Name <noreply@example.com>";
    mail($email,"(Subject)", $message,$headers);
It is probably some spam filter thing, but apparently it is possible to send emails with activation links - I just got one when I registered in this forum :D

So, how do I fix this?

- Magogan

EDIT: The problem just disappeared, apparently it was the spam filter of my email provider.

Post Reply