473,416 Members | 1,869 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,416 software developers and data experts.

mail() sends as "nobody", causing server error

I'm troubleshooting a program that I didn't build, so forgive me on
this one. It's called email.php, and it looks like a program that the
original developer must have downloaded from somewhere.

The part of the program that sends an email states this:

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
if (isset($_REQUEST["bcc"])){ $headers .= 'Bcc: '.$bcc. "\r\n"; }
$headers .= 'From: '.$from.'' . "\r\n";
if (isset($_REQUEST["cc"])){ $headers .= 'cc: '.$cc. "\r\n"; }
if (isset($_REQUEST["bcc"])){ $headers .= 'Bcc: '.$bcc. "\r\n"; }

// Mail it
error_reporting(E_ERROR | E_WARNING | E_PARSE);
mail($to, $subject, $message, $headers) or die("<h3>Cannot send mail.</
h3><br>mail(to, subject, message, headers)<br>mail($to, $subject,
$message, $headers)");
header("Location:".$_REQUEST["LocOK"]);
exit;

(Note, this is copy-and-pasted, and I know that the BCC field is in
there twice, but I left it verbatim in case there's an error there
that's causing my problem. The BCC field isn't utilized with the form,
though, so I think this error is irrelevant.)

The problem is that when it emails out, the server recognizes it as
coming from "nobody," which is automatically bounced to me. I set the
server up to refuse "nobody" emails as a hack-attack preventative, but
it's usually not a problem... until now.

I COULD change the server to allow "nobody" emails, but I would rather
not. Is there a way to modify the script to show the sender as
something besides "nobody"? Having something in the $from variable
doesn't seem to be enough.

This is just a guess, but based on the bounced message, I assume I
need to include the $from variable in the following fields that
currently say "nobody":

Return-path: no****@mydomain.com
Received: from no****@mydomain.com
(envelope-from <no****@mydomain.com>)

Any ideas?

TIA,

Jason

Mar 28 '07 #1
4 3878
On 27 Mar 2007 22:54:53 -0700, "Jason" <jw*******@gmail.comwrote:

>This is just a guess, but based on the bounced message, I assume I
need to include the $from variable in the following fields that
currently say "nobody":

Unless I'm missiing something, you don't have a From: line in your
headers at all!
<http://www.php.net/mail/>
--
Locate your Mobile phone: <http://www.bizorg.co.uk/news.html>
Great gifts: <http://www.ThisBritain.com/ASOS_popup.html>
Mar 28 '07 #2
Jason wrote:
if (isset($_REQUEST["bcc"])){ $headers .= 'Bcc: '.$bcc. "\r\n"; }
$headers .= 'From: '.$from.'' . "\r\n";
if (isset($_REQUEST["cc"])){ $headers .= 'cc: '.$cc. "\r\n"; }
if (isset($_REQUEST["bcc"])){ $headers .= 'Bcc: '.$bcc. "\r\n"; }
Argh!!!

This script will become a source of spam.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Mar 28 '07 #3
Jason wrote:
I'm troubleshooting a program that I didn't build, so forgive me on
this one. It's called email.php, and it looks like a program that the
original developer must have downloaded from somewhere.

The part of the program that sends an email states this:

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
if (isset($_REQUEST["bcc"])){ $headers .= 'Bcc: '.$bcc. "\r\n"; }
$headers .= 'From: '.$from.'' . "\r\n";
if (isset($_REQUEST["cc"])){ $headers .= 'cc: '.$cc. "\r\n"; }
if (isset($_REQUEST["bcc"])){ $headers .= 'Bcc: '.$bcc. "\r\n"; }

// Mail it
error_reporting(E_ERROR | E_WARNING | E_PARSE);
mail($to, $subject, $message, $headers) or die("<h3>Cannot send mail.</
h3><br>mail(to, subject, message, headers)<br>mail($to, $subject,
$message, $headers)");
header("Location:".$_REQUEST["LocOK"]);
exit;

(Note, this is copy-and-pasted, and I know that the BCC field is in
there twice, but I left it verbatim in case there's an error there
that's causing my problem. The BCC field isn't utilized with the form,
though, so I think this error is irrelevant.)

The problem is that when it emails out, the server recognizes it as
coming from "nobody," which is automatically bounced to me. I set the
server up to refuse "nobody" emails as a hack-attack preventative, but
it's usually not a problem... until now.

I COULD change the server to allow "nobody" emails, but I would rather
not. Is there a way to modify the script to show the sender as
something besides "nobody"? Having something in the $from variable
doesn't seem to be enough.

This is just a guess, but based on the bounced message, I assume I
need to include the $from variable in the following fields that
currently say "nobody":

Return-path: no****@mydomain.com
Received: from no****@mydomain.com
(envelope-from <no****@mydomain.com>)

Any ideas?

TIA,

Jason
Jason,

First thing you need to do is take that script offline. If spammers
find it you'll have about 15 minute before you're in every spam source
blacklist in the world. And a good hosting company will shut your site
down until you get it fixed.

Then get a secure contact form up there. I can't recommend any offhand
- I wrote my own and use it on various sites. But there are ones out
there. You could try hotscripts.com or see what others here recommend.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 28 '07 #4
"Jason" <jw*******@gmail.comwrote in news:1175061293.558023.29400
@n59g2000hsh.googlegroups.com:
The problem is that when it emails out, the server recognizes it as
coming from "nobody," which is automatically bounced to me. I set the
server up to refuse "nobody" emails as a hack-attack preventative, but
it's usually not a problem... until now.
And to address your question (someone correct me if I'm wrong):

You are running php as an Apache module, correct?

I believe in this environment, Return-path is going to be the web-server's
username, unless you hack something in your mail server software (e.g.
sendmail). The other from headers you should be able to set within your
(more secure) script.

However, if you have php running as CGI then the Return-path will be set to
the username that php is running as.

I believe searching on "tectite" and mail and form will bring you to a
(relatively?) secure mailform script. Do NOT use "Matt's".

Apr 1 '07 #5

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

Similar topics

0
by: R. Gregg Reed | last post by:
I bought a script called WebDate and installed it on my server, where it worked fine. A week ago my hosting company installed phpsuexec, and now the mail function won't work. I keep getting errors...
1
by: Giobibo | last post by:
Hi. 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...
8
by: Askari | last post by:
(Help for Pygame module) Hi, How I can make a "fadeout text"(alpha at 255,254,253...0) on a surface and my surface's background must be transparatly? Note : I can do a fadeout but with a...
70
by: Roy Yao | last post by:
Does it mean "(sizeof(int))* (p)" or "sizeof( (int)(*p) )" ? According to my analysis, operator sizeof, (type) and * have the same precedence, and they combine from right to left. Then this...
31
by: Yeah | last post by:
Is it absolutely necessary to include "http://" in an A HREF hyperlink? Would it be wise to remove this from one's Links page, just to save code?
19
by: hansBKK | last post by:
Upfront disclaimer - I am a relative newbie, just starting out learning about PHP, mostly by researching, installing and playing with different scripts. I am looking for a host that will provide...
4
by: Fro | last post by:
Hi, the operating system (Unix) considers a php-server as a user with name "nobody". For example, if my php-script saves a file uploaded by a user, the owner of the file will be "nobody". I...
4
by: Jeff | last post by:
I haven't used php to send mail yet and have some questions. I see that you can add headers, and these days it is essential to have a real "from". But I see you can also do this: ...
4
by: jamesnkk | last post by:
Hello, I am a newbie in Linux. My company have a tester machine installed with Suse 10 samba. I have set the IP address of the Linux machine to connect into the Windows 2003 server. So from my...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.