473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

mail not sent when headers are used

134 100+
hi
i m using mail() function to send mails and it works well for an sample message without including headers.,

when i include headers and send an html content or an sample content i didnt receive an mails ., no mails in spam folder too..

here is my code:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $fname='vijay';
  3. $header="MIME-Version: 1.0\r\n"; 
  4. $header.="Content-type: text/plain; charset=iso-8859-1\r\n"; 
  5. $header.="From: ".$fname." <from@example.com>\r\n";
  6.  
  7. $msg='
  8. <table width="100%" cellspacing="0" cellpadding="0">
  9.   <tr>
  10.     <th align="right" valign="top" scope="row">Name</th>
  11.     <th align="left" valign="top" scope="row">&nbsp;</th>
  12.     <th align="left" valign="top" scope="row">Vijay</th>
  13.   </tr>
  14.   <tr>
  15.     <th align="right" valign="top" scope="row">Address</th>
  16.     <th align="left" valign="top" scope="row">&nbsp;</th>
  17.     <th align="left" valign="top" scope="row">Madurai</th>
  18.   </tr>
  19.   <tr>
  20.     <th align="right" valign="top" scope="row">Tel</th>
  21.     <th align="left" valign="top" scope="row">&nbsp;</th>
  22.     <th align="left" valign="top" scope="row">9876543210</th>
  23.   </tr>
  24. </table>
  25. ';
  26.  
  27. $subject="testing".date('d-M-Y H:i:s');
  28. $to='to@example.com';
  29.  
  30. mail($to,$subject,$msg,$header);
  31.  
  32. echo "success";
  33. ?>
  34.  
i got the message "success" printed but no mails received.

thanks
Jan 7 '10 #1
2 1404
Dormilich
8,658 Expert Mod 8TB
you always get printed "success", even if the mail() function fails. you have to explicitly test the function’s return value to make sure.
Jan 7 '10 #2
vjayis
134 100+
tried using
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $return=mail($to,$subject,$msg,$header);
  3. echo "success";
  4. var_dump($return);
  5. echo $return;
  6.  
  7. ?>
  8.  
and got result as

successbool(false)

so what do i want to do..
Jan 7 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: pee2pee | last post by:
Hi, I have below code: <html> <head> <title>Contacting Worldpay, Please wait.......</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
6
by: jerrygarciuh | last post by:
Hi folks, HELP!!!! My habitual use of mail() is causing me some grief. I am having slightly different results depending on the server I use but the gist is that mail() is returning 1, and I...
2
by: eng.sharif | last post by:
hi group how i can send mail and attachement in php with "mail function " $s = mail($to,$subject,$cont, $headers); can anyone help
12
by: e_matthes | last post by:
Hello everyone, I am trying to use the mail() function to send a simple, text-only message. I have two websites hosted by the same company, on different servers. One is old and established,...
5
by: Dave | last post by:
Hi All, I'm experiencing problems with sending mail using mail() to forwarded email accounts. The problem seems to revolve around the optional 4th argument of mail(), namely 'additional headers'....
2
by: empiresolutions | last post by:
I am using a standard mail function within an AMFPHP Class that i have used many times. Now, when i use it it does not work right. When a mail is sent, the $header info and html shows in the email. ...
1
by: the_ricka | last post by:
Hi all, I'm fairly new to python, but very excited about it's potential. I'm trying to write a simple program that will accept input from a command line and send email. The parameters I used on...
5
by: Gordon | last post by:
I'm working on a reset password script for my CMS, that will generate a random password and email it to a user when they request one. The problem I am having is that the mails being sent out are...
3
by: swethak | last post by:
Hi, i placed the php in windows server 2003 manually , set the path in Environmental variables , and place the php.ini file in windows. Now php works fine in my server sytem.When i write the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.