I get error “Failed to Receive” when i use mail() in php

前端 未结 2 777
野趣味
野趣味 2021-01-24 14:37
$strBody=\"
相关标签:
2条回答
  • 2021-01-24 15:14

    $to= $_SESSION['email']; Are you sure that your session contains correct e-mail address? Try to debug it. Maybe you forgot session_start before any output?

    0 讨论(0)
  • 2021-01-24 15:18

    According to the PHP Manual for mail(), the lines in the message must be 70 chars long max. and should be separated with \n (LF). While I've never encountered a problem caused by this, you can give it a try.

    Oh, I generally write down message HTML in a single string like:

    $message = '
        <div>
            <span>...
            ...etc...
            ';
    

    So it's getting newlines automatically. You can simply trim $strBody=$strBody." parts and concatenate the message into a single multiline string.

    If you can't get it working, you can try ready-made classes like Zend Mail.

    0 讨论(0)
提交回复
热议问题