Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Mail() Function Not Working When Adding A Headers Parameter?


This works:

$to = "email@address.com";
$subject = "CONTACT FORM";
$body = "test";
mail($to, $subject, $body);

But when I add an additional parameter $headers, it doesn't work:

$to = "email@address.com";
$subject = "CONTACT FORM";
$headers = "From: My Name Here";
$body = "test";
mail($to, $subject, $body, $headers);

What could I be doing wrong?




View Complete Forum Thread with Replies

Related Forum Messages:
Mail() From: Headers Not Working
i have a couple scripts on my site that send emails, and they've
all been working for months with no problems. all of a sudden the from
headers aren't working, so the messages all come from the server
(texasnee@web012.ahp01.lax.affinity.com) instead of the address
specified. i haven't changed anything in the scripts and i didn't
(knowingly) make any changes to the server....

View Replies !
Mail Headers For Online App Are Not Working Properly
We switched to a new host last night and for some reason my mail headers for my online app are not working properly. The following code use to display the incoming apps as an html page in Outlook. Now it displays "Content-type: text/html; charset=iso-8859-1" at the top along with the page source below it.

$mailheaders = "MIME-Version: 1.0";
$mailheaders .= "Content-type: text/html; charset=iso-8859-1";
mail($allRcv, $subject, $msg, $mailheaders);

View Replies !
Warning: Mail() [function.mail]: Permission Denied: Headers Injection
I wrote many years ago a small shop application as hobby for a customer. Worked well until a few days. I'm not a php guru and don't understand why I get now this permission problem.

Warning: mail() [function.mail]: Permission denied: headers injection (empty line) in /home/www/edfedca4df03c5ff2685003537a08dd5/web/minishop/mail.php on line
145

mail($this->to, $this->subject, "", $mime); <- LIGNE 145

View Replies !
Checking The 'message' Parameter Of The Mail Function
I would imagine it is a fairly common situation for a site to allow the
user to enter some text into a field and then to have that text passed
to the 'message' parameter of the mail function
(http://us4.php.net/manual/en/function.mail.php).

Is it a good idea to pass this text through some other function first or
can it be sent through as is? Is this a case where the maxim 'do not
trust input from the user' does not apply?

View Replies !
Headers Use In The Mail() Function
Does anyone know a page/website with an overview of all the headers one can use in the mail() function with some explanation?

View Replies !
Headers Using Mail() Function
I know there is lots of information out there and I've taken a look, but I want to learn how to do this myself. And I'm a beginner here and some of it I don't understand (so no flames, RTFM or GFGI

Here's my function:

function send_mail($to_name, $to_email, $from_name, $from_email,
$subject, $message)
{
$thedate = date("r", time());

$headers = "X-Mailer: PHPMailProgram/1.0";
$headers .= "From: "".$from_name."" <".$from_email.">";
$headers .= "Date: $thedate";
$headers .= "Content-Type: text/plain";
$from = "".$from_name."" <".$from_email.">";
return mail( $from, $subject, $message, $headers);
}

My problem is that it will never arrive with the "Name" <email address>, and I can only make it work using email addresses without the names or the angle brackets around the email addresses. Once I tried printing the headers and the quotes and angle brackets turned up, but no names or email addresses. And once an email arrived but with nothing but angle brackets! (I wonder how that happened? The SMTP server must have stripped things out perhaps?)

View Replies !
Headers For The Mail() Function
I have been having some email problems with emails from my server being sent into spam or not delivered at all by some isps.

I have solved most of the problems by setting various headers, but two things I can't seem to set with this function are 'return-path' and 'envelope-from' which both seem to be set to my hosting server and not my domain name. Code:

View Replies !
Problems With Headers Using Mail() Function
I meant to write:

function send_mail($to_name, $to_email, $from_name, $from_email,
$subject, $message)
{
$thedate = date("r", time());

$headers = "X-Mailer: PHPMailProgram/1.0
";
$headers .= "From: "".$from_name."" <".$from_email.">
";
$headers .= "Date: $thedate
";
$headers .= "Content-Type: text/plain

";

$to = "".$to_name."" <".$to_email.">";

return mail( $to, $subject, $message, $headers);
}

View Replies !
Mail() Function - Additional Headers
I writing a script to send emailing using php and the mail() function. All of the codes is tested on a different server than I am currently using and works. The code I am using now works but it will not send email to .edu addresses. Has anyone ever heard of this? Could this be a problem with my php.ini file? Do I need additional headers that I don't
have? Any thoughts would be of service. Like I said I've gotten it to work on a different server, I do not have access to that php.ini file but I now have access to my current servers php.ini file if that is where the problem lies. mail() sending emails fine to .com addresses (from what I can gather, sends them to gmail and hotmail) but like I send not .edu address.

View Replies !
Adding Result Row To Mail Function
I have an email script that will pull the addreses from my club membership database. That part works fine. the problem I am having is being able to include row results inside of the actual email message. My message variable is something like this: Code:

View Replies !
Mail() Function Not Working
I recently moved hosts and I am now using QMail instead of POSTFIX. My PHP mail() functions that used to work, now do not show HTML. Here are my mail() headers:

$headers = "From: "My Name" <myemail@test.com>";
$headers .= "Reply-To: myemail@test.com";
$headers .= "MIME-Version: 1.0";
$headers .= "Content-Type: text/html; charset=ISO-8859-1";
$headers .= "Content-Transfer-Encoding: 8bit;";
$headers .= "";
mail("sendto@test.com", "Subject Goes Here", "Message Containing HTML Code", $headers);

When I get emails, it prints this at the top of the email:

Content-Type: text/HTML; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit;

I was wondering if my headers are incorrect?

View Replies !
Mail Function Not Working
I haven't programmed for a while but the form that I just created seems like it should work. Everything is worked except that the form isn't being emailed to me. I am using the normal mail() function on line 61.

View Replies !
Mail() Function No Longer Working
I was recently writing a script that utlises the mail() function, I could not figure out why it wasn't working, I tried different recipients as well. It seems that the mail() function is broken, as a few other scripts that were unchanged also no longer work.

What are the possible reasons for mail() to stop working? In the past it has been due to the mailbox being full, but it is empty at the moment.

The only thing I can think of is my ISP has broken something in PHP or sendmail, I'm out of ideas...

View Replies !
PHP Mail Function Stopped Working
Yesterday before 2:30, we were receiving email from the servers just fine. The same code today doesn't work. We haven't received an email for almost 24 hours now from the server. I've looked at every different way we send email:

Newsletter program: works with SMTP send, but not PHP mail send (it has the option)
CGI Forms: work
PHP Mail pages - nothing.

I've gone through everything I did yesterday, and I can't find anything that I could have changed that could possibly be making this type of problem occur. After 2:30, I picked up my kids from school, created two new pages on the domain that had nothing to do with mail, and got a CSR for a new SSL cert. Our server admin doesn't remember doing anything either. What could possibly be causing this?

View Replies !
Mail Function Not Working On XAMPP
I've tried EasyPHP and normal PHP configuration and mail function worked well, but now I have XAMMP and my mail function is not working anymore. I've installed the full package of XAMMP succesfully. Error I got after trying to send. We do not relay non-local mail, sorry.

View Replies !
Mail Function Not Working Properly
i am using php mail function to send an email to myself from the website (from mydomain.com to zeeshan@mydomain.com). The email gets sent and there are no errors and warning but i'm not getting it. Now the funny thing is, i get an email when i try to send it on my hotmail or gmail address.

Anyone has had the same problem or can suggest a solution?

View Replies !
Mail To Function Not Working To Aol Or Gmail
i'm using the php mailto function

mail($email, 'Account Information', $message, "From: "test"<test@mysite.com>");

this works to my regular email but does not work to my gmail email or my clients aol email

has anyone else run into this??

View Replies !
Mail Function Not Working On My Network
SO i'm almost 100% sure my code is good as I basically copied and pasted the same code I had working on my web server. Now, I have it setup to email a form from a network server php file. The problem is that it isn't working. Neither is a header Location line either for that matter. I'm wondering why this is. Could it be because somehow these require php libraries that they don't have access to? It works fine on my web server.

Here's the code just for kicks, but like I said, it shouldn't be the code: ....

View Replies !
Mail() Function Randomly Stopped Working
The problem that I am having is that I have a page that uses the mail() function.  The page is on admin panel of a store and is called from another page that lists all of the orders.  Basically, the script updates the status of the order to indicate that the payment has been received and sends an email to the customer to notify them of the payment receipt.  The script was working fine for months, but recently stopped working completely.  (Although no error is thrown.)  The only thing that I can think that could have affected this is that the host recently upgraded from PHP 4 to PHP 5; however, I have another site on the same account where the mail function works just fine.  Any ideas? Code:

View Replies !
Mail() Php Function Not Working In Windows Server 2003
I tried the mail() php function and it ends up with error message. I tried different tests with port configuration and Smtp server, though it ended up in error.

Error: Code: Original - Code Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in c:program fileseasyphp1-7wwwmailerman.php on line 19 Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in c:program fileseasyphp1-7wwwmailerman.php on line 19.

View Replies !
Mail() Function Not Working With Sender's Hotmail Email
i have this mail() function which works fine but i've tested it with
hotmail where i use hotmail email address for sender and receiver also
hotmail. If I type in a not existent email address for sender and a
right address for receiver, the email is not sent. But if I use
non-existent email and yahoo receiver email, then the mail is delivered
correctly. What's with hotmail? Is there something I can do to prevent
it with mail() function, or extra headers? or is it simply something to
do at the hotmail's end?


View Replies !
Mail() - Fifth Parameter In SAFE MODE
I want to send mail with the function mail().
I am on a shared server in SAFE MODE.

When I send a mail I get the message:
"SAFE MODE Restriction in effect.
The fifth parameter is disabled in SAFE MODE"

But I need the fifth parameter, because it is the only way to set my
own Return-Path (instead of nobody@server....)

I tried this too:

echo ini_set("safe_mode",0);
mail($admin, $subject, $message, $head, "-f$email"))
echo ini_set("safe_mode",1);

but it does't work.

View Replies !
Redirection Headers Not Working In NN ?
I am having trouble refreshing pages with Netscape Nav 6.1 while using the folowing :
PHP Code:

View Replies !
Function Parameter
Assume you define a function that is called with a constant as parameter. Within that function, based on some condition it calls itself recursively. Example:

<?php
function Test($firstcall) {
echo "(enter) firstcall=$firstcall<br>";

if (some_condition) {
Test(0);
}
echo "(leave) firstcall=$firstcall<br>";
}
Test(1);
?>

I need that variable/parameter before and after the main part of the
function. For the first call, the (enter) output shows that $firstcall=1,
but the (leave) always shows $firstcall=0, if the function has been
called recursively. I don't use parameters by reference but by value. So
how must I declare $firstcall correctly to maintain its content within
subsequent calls?

View Replies !
Html Mail() - Wrong Parameter Count Error
i have a form that sends a message to the user and i need to incorporate just one link into the body of the message. i've researched using classes, but i thought i could use the mail() function instead. however, i'm getting a wrong parameter count error when using this script. can anyone help steer me in the right direction? for all i know, i could be way off base w/ this one - can it be done? PHP Code:

View Replies !
Function Parameter Question
What does the "=array()" mean? It works with or without it in PHP5. The
code was written for pre-PHP5.

public function getPhrase($a_stName, $a_astValues = array())

View Replies !
Function Parameter Passing
I wrote a function that did not seem to work so
I checked whether the parameter I was passing to the function was
actually being used. I found that it wasn't. When I run the following
code I get:

Testcheck:

and nothing else. It seems that the variable is not being passed to
the function. Here is the code:

function file_write_position($textcheck) {
print "Testcheck: " . $testcheck . "<br>

";
return;
}

$testcheck="# Test Call Area";
file_write_position($testcheck);

View Replies !
Function With Optional Parameter
How to create function with optional parameter passed by reference?
I've tried sth like this:

function (&$param=NULL) // or: function (&$param=new array())
{
//...
}

but parser is complaining that it expected ')' after $param. I know functions with optional parameters passed by reference exist in PHP (ie. ereg). So what am I doing wrong.

View Replies !
Passing A Reference To A Function As A Parameter?
I'm writing a class that accepts a SQL query and outputs an HTML table of the results. It's designed so you can do some pretty extensive formatting of individual columns.

I'd like to give the user the ability to process particular column data with a custom function handler - for example, they might want to process a field that contains a dollar amount by running it through a function that prepends a dollar sign and inserts commas between grouped thousands. Something like this:

$foo = new MyClass();
$foo->addCustomHandler( 'column_name', [specify handler function here] );

Currently, the class user passes in the name of the handler function as a string, and the class invokes it with eval(). This works, but using eval() makes my skin crawl - it's just not an elegant way to do things.

In JavaScript, functions are objects, so you can pass them around and reference them like any other variable, but that's not the case in PHP.

View Replies !
Mail() Function - Using The Mail() Function To Send Emails To Members Of A Website
I am using the mail() function to send emails to members of a website. For some reason when I include words such as "free" or "winner" the mail does not send to any of the addresses - it just seems to disappear in space. I figured this out by trial and error - once I removed those words, it worked. I am running cPanel on the server and have no problem sending emails as long as they don't use those words. It seems to be blocking certain words - ones that I assume spammers would use.

View Replies !
Mail Problem - Warning: Mail() [function.mail]: SMTP Server Response: 550 Invalid Recipient:
Whenever the recipient's email address includes a hyphen ( - ), I get the following error message...

Warning: mail() [function.mail]: SMTP server response: 550 Invalid recipient:

I should stress that this only seems to occur when the hyphen is in the URL portion of the address, i.e example@perfect-example.com

The current code works along the lines of...

mail ($_POST['email'], 'Email subject is here', $body, $headers);

View Replies !
How Can I Pass A Parameter Array From PHP To A Javascript Function
I have a Javascript function that validates an specific form. As
parameters this function receives an array of elements to be checked.
Depending on the form in cause, the array could have variable lenght.
I don't know how can i pass a dynamic array on 'onsubmit' event form
PHP code to a JavaScript function.
I would like to do something like:

<script>
function Valid_Form(ElementsArray)
{
alert (ElementsArray[0].value);
alert (ElementsArray[1].value);
return (true);
}
</script>

....

<?php
...
echo "<form method='post' action='?oper=confirm' onSubmit='return
Valid_Form(this.elements[0], this.elements[1])'>";
...
?>

But it don't work!

View Replies !
Trying To Pass By Reference To An Optional Function Parameter
I am trying to make a function that takes an optional parameter that gets passed by reference. Here is the first line of my function definition:

function funQueryDatabase($strQuery, &$intInsertId = NULL) {

I am getting this error:

Parse error: parse error, expecting `')'' in c:program
fileseasyphp1-8wwwmy_query_database_function.php on line 7

Line 7 is the first line of my function definition (above). Code:

View Replies !
Passing Array To A Function As A Single Parameter
how can you pass an array to a function as a single parameter?

View Replies !
Function Parameter Passing? Session? Static? Global?
The 'main' page contains a call to a function in an included file. This
function puts a html-form on the screen. Before the form gets posted (to the
'main' page) some prior errorchecking is done. The form fields are then sent
and an object is created (all in the same function).
What I need ( imo ) is an array with objects that can be written later to a
dbfile to preserve.

But I cannot find a solution for the extension of the array.

the function statements are simply these:

< inside function in included file >
$o = someObject( $s ) ;
$objarr[] = $o;
</ inside function in included file >

As this array is within a function it is local to this function.
As I understand it now a good solution would be to pass the array to the
function.
In the 'main' page I made a variable $objarr that is passed into the
function like this:
<'main' page>
$objarr ;
function( $objarr )
</'main' page>

The PHP manual states that in the absence of the array variable it gets
created. {Does this mean that function( $objarr ) would suffice? }
However,
whatever I try, I end up with the creation of $objarr[ 0 ] only.

View Replies !
Mail() And To: Headers
I'm using the mail() function to send e-mails. The first argument to the
function is the e-mail address the mail will be sent to. I understand this
should just be in the format 'address@domain' and not '"Name"
<address@domain>' and that if I want to specify the name of the recipient as
well as the address of the recipient I should pass it as an addition header.
This works fine locally under Windows and Apache but remotely under Linux
and Apache the resultant raw message has 2 To: headers meaning the client
displays it as being sent to 2 addresses (the same address twice). Am I
doing this correctly? It seems a clumsy way of doing it, especially as
SpamAssassin marks down a message with only an email address in the two
header.

View Replies !
Mail Headers
I have a problem writing mail headers with php. When i set the from: field, the resultant mail have the host name and the ip from it has been written.Can i make appear in the headers the address i would want for the from: field?. That is that in the resultant mail, all the information will be related to the from: field, not to the place or host where the mail has been sent.

And another question: Can i make people who'll answer my mail answer me instead of answer the address in the from: field?. I use the Reply-To: field in the header but it sets an address to send the answer and appears in the Reply: field in the resultant answer mail. Can i make appear an address in the Reply: field of the answer mail and make it be sent to another address instead?.

View Replies !
Mail() Headers?
I've made a mailing list and im having trouble with mail() It sends the mail each person in the database, but it keeps going in the spam folder =/
i tried using lots of different headers: Code:

View Replies !
Headers In Mail()
This is all I need: mail($recipient, $subject, $message);

View Replies !
Php Mail() Headers
i've been using the same trusty old class using mail() for years, but on this new server it appears the headers are getting ignored by the mail client and showing from: as being from the name of the shared server the script is now sitting on. the format i am using for my header is:

"From:myrecipient
Reply-To:mail@mymail.com"

View Replies !
Adding Vars Not Working
I have a multidimensional array populating a drop down box, and I'm pulling variables from that array for my confirmation page. Code:

View Replies !
PHP Mail() And Subject:, From: Headers
I'm using PHP to send mail using the following commands:

$to = "receiver@domainname.com";
$subject = "test email";
$message = "test message goes in here";
$from = "sender@domainname.com";
mail("$to","$subject","$message","From: $from");

When receiver@domainname.com receives the email, the "From" and "Subject" fields don't seem to be passed to the message header. In fact, the "Subject" header ends up being blank, and the "From" header ends up being "root@URL".

My values for "Subject" and "From" appear in the body of the message rather than in the message header. Any idea how I can force my values for "Subject" and "From" into the message header? And any ideas why the PHP mail command isn't able to do this?

View Replies !
Problem: No Headers Sent With Mail()
My hostingprovider just updated to PHP 4.4. Since that time I have problems
using the mail() function in PHP. I can't send headers anymore and my
provider don't know what's wrong.

Here's a sample script:

if (mail("xxx@xxx.com", "test mail", "This is a <B>test</B>!", "From:
yyy@yyy.com (yyy)
Content-type: text/html")) {
print "Sent";
}
else {
print "Not sent";
}

I receive this body-text on xxx@xxx.com:

Content-type: text/html
Message-Id: <20050908074313.09205430036@xxx.xxx.com>
Date: Thu, 8 Sep 2005 09:40:02 +0200 (CEST)

This is a <B>test</B>!

View Replies !
Problems Using Mail() Headers
I am having trouble sending mail with PHP's mail() function when I try to use CC or BCC in the additional headers. Here is the code I have now: Code:

View Replies !
How Does One Use To Parse Mail Headers?
I am very new to PHP (or any type of scripting language), and am trying to
write a PHP script that will accept email headers posted into a form.

Upon submission, the script needs to parse the time, date, and mail server
info. In the end, it should respond with how much of a delay it took for
the original message. Code:

View Replies !
Mail Headers Suggestions
My current tiny email script seems to work good....email is sent as html and so far is displaying ok in outlook, gmail, hotmail, etc. Only problem I have is certain spam filters. Gmail seems to let the email ok but hotmail does not. Code:

View Replies !
Adding Data To Table, No Working
I'm having trouble with a script that is supposed to add data to my table. It shows it on screen, but doesn't write to the database. Code:

View Replies !
Mail Headers Appearing In The Email
I am trying to send plain text email with the following code. PHP Code:

View Replies !
MIME Mail Headers (date)
i am trying to edit my email headers fo a simple email to manipulate the date field ,ie: i want to set the date the email was sent and when the client displays the date it will show up as the date i used , i have tryed a few fields but none seam to work correctly.

what will happen with this is that say i sent the email to a hotmail account it would display in the list the correct date it was sent on but once opened the date field will show the date i have entered. is there a correct way to do this so in the main list it will show as if it arrived on the date i sent it ??? PHP Code:

View Replies !
Mail Headers And Auto-reply
I'm working on a corporate email routing script that takes input from a customer service form, and sends the message to customerservice@domain.com...

During the script, there are certain triggers that will notify other company users of the message send using a BCC header to send it along to those users higher up in the company. (regional managers, and corporate officers)... Now, here's the situation that I haven't ran across yet, and need to make sure never comes up...

I think it may be solved via the Reply-To or Return-Path headers, but I'm just not sure, and can't find exactly what I'm looking for online. Customer 1 sends an email that gets sent to customerservice@domain.com via To header and sent to regional_manager@domain.com, and corp_officer@domain.com via BCC header.

What happens to the out of office auto-reply if the regional manager or corporate officer have those set and are on vacation? I DO NOT want these replies to return to customer1 revealing the email addresses of the higher-ups.

View Replies !
PEAR Mail - $recipients Vs. $headers['to']
So, what's the story here? The manual says I can use an array or csv
in the $recipients, but using the same array in the $headers[to] gives
me an Array@myhost.com.

It works, and both joe and larry get the mail, but I guess I'm using
the $headers[to] incorrectly...

<?php
include('Mail.php');
$mail_object =& Mail::factory('mail', $params);

$to = array('joe@adsfadsfads.com','larry@asdfasdfasd.com ');

$headers['From'] = 'webform@sadfasdfasdfasdf.com'
$headers['To'] = $to;
$recipients = $to;
$headers['Subject'] = "website form";

$body = $message;

$mail_object->send($recipients, $headers, $body);
?>

View Replies !
Mail() Is Not Setting Up Headers Correctly
mail() is not placing the headers data in the headers section of the message, but instead in the body.

I took the code straight out of the php.net manual. What do I need to do to signify that this is HTML email to the client yet not have header codes showing up in the body? (Also Eudora is not reading the From header, when I click reply the To: is blank...)

To: erik@domain.com
Subject: Erik, your Password Request

Content-type: text/html; charset=iso-8859-1
From: Management <support@domain.com> ....

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved