Jump to content
westman

simple email on php 7.1

Recommended Posts

I have been using the same script for years to send an email. However, php 7.1 on goddady is new to me, so that mite be the problem.

Here is what I have.

$message = wordwrap($message,70);
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
mail($to, $subject, $message, $headers);

I am not getting emails. What is the problem here?

Share this post


Link to post
Share on other sites

You have $to defined somewhere, right?  Make sure that the from address is set to the same domain as your web site.

Share this post


Link to post
Share on other sites

Full code below

$to = $email;
$from = "system@site.com";
$subject = "hello";
$message = '<html>
<body bgcolor="#FFFFFF">
Dear Member,
<br /><br />
hello
<br /><br />
</body>
</html>';
$message = wordwrap($message,70);
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
mail($to, $subject, $message, $headers);

 

Share this post


Link to post
Share on other sites

$to is just set to another variable.  Soo.... that variable is set to an actual email address, right?  If you're not sure then print the values of everything before you send the email.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...