简体   繁体   中英

PHP mail not showing up on email

I have created a small script that sends a multipart email via php the mail() (that has been a challenge in itself!).

When I test the script and send and email it all works fine, but when I try another address (one which has the same domain as the server) the email appears blank. All the content is there when you look at the raw code, but nothing displays.

I solved the problem by removing the doctype tag from the code and left everything bare coded.

I also noticed the php variable

$body=' (html code here) '

The whitespace after ' was causing the email to show up empty sometime... I'm not exactly sure why!

I have encountered a similar issue and it was because I had a website www.example.com sending an email to me@example.com but the web server and email servers were on different machines. I had to ask the host to sort it so that the website wouldn't try to route emails within the server itself.

I managed to sort this by changing my own code to instead using something a little more supported - phpMailer .

I found this very easy to use and install into my own code. Also giving me as much flexibility as I had with my original code.

I guess though this isn't sorting the original problem, but it did seem to sort on my code.

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