简体   繁体   中英

sending mail from php when link in message body

i have a php script

<?php
$to = 'somebody@somedomain.com';
$subject = 'Test mail';
$message = 'mysitedomain.com';
$from = 'support@mysitedomain.com';
$headers = 'From:' . $from;
mail($to,$subject,$message,$headers);
echo 'Mail Sent.';
?>

When i run this code mail not send. If i change message to mysitedomaincom (without dot before com) the mail send succesfull.

Anybody have a solution for this?

This codes that tells the mailer and the recipient that the email contains well formed HTML that it will need to interpret

If you want you can change content of $message, now with this codes you can send HTML content mail.

<?PHP
    $to = 'somebody@somedomain.com';

    $subject = 'Test mail';

    $headers =  "From: Support <support@mysitedomain.com>" . "\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

    $message = '<html><body>';
    $message .= '<h1>mysitedomain.com</h1>';
    $message .= '</body></html>';

    mail($to, $subject, $message, $headers);
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM