I’m trying to send a message to a user with HTML button that has a link.
I’m making content (message body) from reading a file with html code that is working standalone as far as displaying my button.
My php code and the content from the file are shown below.
It seems to get hung up on everything in the style section not recognizing it.
$Recipient = $the_user->ID;
$Sender = 1;
$subject = ‘Welcome to myvirtualpersonaltrainer.com’;
//Content is in file messageBodyForClientLogin.txt
$filename=”messageBodyForClientLogin.txt”;
$file=fopen($filename,”r”);
$multilinecomments = fread($file,filesize($filename));
$content = $multilinecomments;
$args = array(‘sender_id’ => $Sender, ‘subject’ => $subject, ‘content’ => $content , ‘recipients’ => $Recipient );
messages_new_message( $args ) ;
file messageBodyForClientLogin.txt
<html>
<style>
.button {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.button1 {border-radius: 2px;}
.button2 {border-radius: 4px;}
.button3 {border-radius: 8px;}
.button4 {border-radius: 12px;}
.button5 {border-radius: 50%;}
</style>
</body>
<p>Welcome to your virtual personal trainer website!!! <br>
Youve taken the first step in joining a virtual personal training site as a trainee. </p>
Request Training Advice</button>
<body>