473,625 Members | 3,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with "mail" function

Hi,

I cannot seem to send emails. What does it mean when the return value
from the "mail" function is an empty string? I'm using php 4.3.11 on
a Yahoo! hosting environment. Here is the code:

$p_from = "da*******@mydo main.com";
$headers = "MIME-Version: 1.0\n"
. "Content-type: text/plain;
charset=iso-8859-1\n"
. "Content-Transfer-Encoding: 7bit\n"
. "From: $p_from\n"
. "X-Mailer: PHP " . phpversion() .
"\n"
. "Reply-to: $p_from";

$retVal = mail("my******* *****@gmail.com ", "Test", "Hello",
$headers);
print "retVal: $retVal<BR>\n";

Any help is appreciated. Here is the configure command from
phpinfo():

'./configure' '--prefix=/usr' '--enable-fastcgi' '--with-config-file-
path=/usr/lib/php' '--enable-memory-limit' '--enable-bcmath' '--enable-
calendar' '--enable-exif' '--enable-mbstring=all' '--enable-mbregex'
'--with-curl' '--with-dom' '--with-dom-xslt' '--with-gdbm' '--with-
gettext' '--with-iconv' '--with-gd' '--with-jpeg-dir' '--with-png-dir'
'--with-tiff-dir' '--with-xpm-dir=/usr/X11R6' '--with-zlib-dir' '--
with-ttf' '--with-freetype-dir' '--with-t1lib' '--enable-gd-native-
ttf' '--with-mcrypt' '--with-mhash' '--with-mime-magic' '--with-ming'
'--with-openssl' '--with-pspell' '--with-regex' '--enable-wddx' '--
with-xmlrpc' '--enable-xslt' '--with-xslt-sablot' '--with-zip' '--
disable-posix'

Thanks, - Dave

Aug 23 '07 #1
1 1484
la***********@z ipmail.com escribió:
I cannot seem to send emails. What does it mean when the return value
from the "mail" function is an empty string?
I suggest you var_dump() the return value rather than using echo.

$headers = "MIME-Version: 1.0\n"
. "Content-type: text/plain;
charset=iso-8859-1\n"
. "Content-Transfer-Encoding: 7bit\n"
. "From: $p_from\n"
. "X-Mailer: PHP " . phpversion() .
"\n"
. "Reply-to: $p_from";
I suggest you examine the actual value of $headers.

Anyway, if there aren't any obvious errors in your code, you host may
have some requirements about the emails it'll accept, such us using a
specific e-mail address as sender. Start debugging with the simplest
test script you can write. You'll have time later to add complex headers
and attachments.

--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor austrohúngaro: http://www.demogracia.com
--
Aug 23 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2617
by: Jim Seymour | last post by:
I have a contact form that uses PHP's mail() function. It recently came to my attention that (some?) MS-Windows mail servers may not properly process data given to the mail() function that's only newline-terminated. The mail() function takes up to five parameters: mail(recipient, subject, message, ]) The ones of interest here are the first four. The questions are
4
4818
by: Data Goob | last post by:
This one has me stumped. How did SuSE disable the mail() function in their RPM'd version of PHP? ( This is their install-version of PHP with RPMs not what you download from PHP.net ) I have an application that emails people a message, and now having installed my PHP application on my customer's machine it doesn't work, giving an error message that the mail() function is not defined.
3
57627
by: HoustonComputerGuy | last post by:
I am working on getting my web applications moved to .Net 2.0 and am having some problems with System.Net.Mail. I get the following error when sending the mail: System.Net.Mail.SmtpException was unhandled by user code Message="Failure sending mail." Source="System" StackTrace: at System.Net.Mail.SmtpClient.Send(MailMessage message) at System.Net.Mail.SmtpClient.Send(String from, String
6
2273
by: sellam | last post by:
I just installed to a new server and am trying to iron out certain bugs. Right now I have a problem with the mail function. I always get a FALSE return value when I call the mail function. This same code was working on my old server. I've done research and spent hours trying to figure out why it won't work to no avail. Here's what I know:
1
4781
by: crescent_au | last post by:
I am developing a simple mailing system. This requires sending emails in HTML format to one or more recipient. I am currently using PHP's mail() function. It works alright but it doesn't seem reliable. I am not able to send email to my hotmail account but it does send to yahoo account. I'm not sure if there is something about hotmail that blocks emails for some unknown reason. If it goes to yahoo, it must go to hotmail. it doesn't even...
6
1711
by: Kurda Yon | last post by:
Hi everybody, I have a problem with the function "mail". It returns "true" but supposed recipients receive nothing. My code is as follows: $to = $form; $subject = "E-mail Verification"; $body = 'The first line\n'; $body .= 'The second line.'; $headers = 'From: webmaster@example.com';
1
3052
by: =?Utf-8?B?VGFsYWxTYWxlZW0=?= | last post by:
i have facility in my website which sends an e-mail to the cleint's inbox..... i am getting a problem when ever i sends an e-mail.. i tried with Hotmail and Yahoo, e-mail goes to the "Junk Mail" folder not the actual inbox.... how i can get e-mail sent the clients inbox not in their "Bulk" or "Junk Mail" box thanks my send e-mail page C# codes are below:
8
2022
by: gggram2000 | last post by:
Hi Im new to this mail function. I have an html page with textboxes, comboboxes and textarea...i'ved named them all and created this php sendmail.php file to send all the data. The only thing is when i click on submit I get this error: Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\sendmail.php on line 12 My php code is this: <?php $Companies = $_REQUEST ; $FirstName = $_REQUEST ; $LastName = $_REQUEST ; ...
3
1473
by: matiruv | last post by:
Warning: mail() : Failed to connect to mailserver at "192.168.0.254" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\selection\Untitled-6.php on line 16 Mail Sent.
0
8259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8192
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8696
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8358
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7188
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6119
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5571
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4195
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.