473,769 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mail() messages bounce with 501 syntax error in MAIL FROM command

Hi,

I have this website that contains an internal message system that allows
users to send each other "email" messages. My client wants me to extend
the system so that when a user receives an internal message, the system
will send an actual email to the user's email address.

here's the sample code:

function notify_recipien t()
/* Send an external email to the recipient of the internal email. */
{
$return = false;
$recip = new User();
if (strcmp($this->recipient, "") == 0 )
{
$this->errormessage .= "Email Recipient is Missing,";
}
else
{
$recip->userid = $this->recipient;
$recip->load_by_id() ;
}
$sender = new User();
if(strcmp($this->sender, "") == 0)
{
$this->errormessage .= "Email Sender Is Missing,";
}
else
{
$sender->userid = $this->sender;
$sender->load_by_id() ;
}
$site = new Site();
$site->site_id = $recip->site_id;
$site->load_by_id() ;

$to = $recip->email;
$from = "<webmaster @" . strtolower( $site->site_name ) .">";
$subject = "New Message at $site->site_name";
$message = "Howdy, $recip->username, \r\n".
"You have received a new message from $sender->username over at
$site->site_name." .
" Please visit $site->site_url to retrieve your message.\r\n\r\ n" .
"Thanks,\r\n\r\ n" .
"The Team at $site->site_name";

$headers = "From: $from\r\n";
if (mail( $to, $subject, $message, $headers))
{
$return = true;
}
return $return;
}

Here's the raw message it generates:

Received: by [host obscured] (Postfix, from userid 72)
id A684219E678; Thu, 10 Feb 2005 16:46:58 -0800 (PST)
To: [email obscured]@yahoo.com
Subject: New Message at LeatherM4M.net
From: <we*******@leat herm4m.net>
Message-Id: <20************ ************@st ud.aliceblue.or g>
Date: Thu, 10 Feb 2005 16:46:58 -0800 (PST)

Howdy, bigredpaul,
You have received a new message from bigredpaul over at [site name
obscured]. Please visit http://[url obscured]/ to retrieve your message.

Thanks,

The Team at [site name obscured]
And here's the message I get back from yahoo, for instance:

<[email obscured]@yahoo.com>: host mx1.mail.yahoo. com[67.28.113.11]
said: 501 Syntax error in parameters or arguments (in reply to MAIL FROM
command)
Does anyone have any thoughts about what I might be doing wrong?

Thanks,

Paul
Jul 17 '05 #1
5 11145
paul brown <nn**@paulbrown .net> wrote in news:ntTOd.3699 $aW6.483
@newssvr22.news .prodigy.net:
Hi,

I have this website that contains an internal message system that allows users to send each other "email" messages. My client wants me to extend the system so that when a user receives an internal message, the system
will send an actual email to the user's email address.

here's the sample code:

[snip]

$headers = "From: $from\r\n";
Remove the \r\n from that line and you should be OK. It's only necessary
if you're sending multiple headers, e.g.

$headers = "From: $from\r\nBcc: fo*@example.com";

Received: by [host obscured] (Postfix, from userid 72) ^^^^^^^^^^^^^^^ Subject: New Message at LeatherM4M.net


hth ;))
--

Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fu ng.arg');
--------------------------|---------------------------------
<http://www.phplabs.com/> | PHP scripts, webmaster resources
Jul 17 '05 #2
Senator Jay Billington Bulworth wrote:
paul brown <nn**@paulbrown .net> wrote in news:ntTOd.3699 $aW6.483
@newssvr22.news .prodigy.net:

Hi,

I have this website that contains an internal message system that


allows
users to send each other "email" messages. My client wants me to


extend
the system so that when a user receives an internal message, the system
will send an actual email to the user's email address.

here's the sample code:

[snip]

$headers = "From: $from\r\n";

Remove the \r\n from that line and you should be OK. It's only necessary
if you're sending multiple headers, e.g.

$headers = "From: $from\r\nBcc: fo*@example.com";


It doesn't matter whether or not they exist or not. I've tried it with
and without.

Thanks though,

Paul
Jul 17 '05 #3
*** paul brown wrote/escribió (Fri, 11 Feb 2005 01:01:07 GMT):
if (mail( $to, $subject, $message, $headers))


If the error is returned by the mail server, the only line in your code
that matters is the one above. What are the actual values of the variables
you pass as arguments?

Hint: echo

--
-- Álvaro G. Vicario - Burgos, Spain
-- Thank you for not e-mailing me your questions
--
Jul 17 '05 #4
Alvaro G Vicario wrote:
*** paul brown wrote/escribió (Fri, 11 Feb 2005 01:01:07 GMT):
if (mail( $to, $subject, $message, $headers))



If the error is returned by the mail server, the only line in your code
that matters is the one above. What are the actual values of the variables
you pass as arguments?

Hint: echo


The values are correct, so it's leading me to think that perhaps the
problem lie in my outgoing mail server.

Thanks,

Paul
Jul 17 '05 #5
paul brown wrote:
Hi,

I have this website that contains an internal message system that allows
users to send each other "email" messages. My client wants me to extend
the system so that when a user receives an internal message, the system
will send an actual email to the user's email address.


I ended up using an open source group of classes called PHPMailer, and
its companion SMTP class. While that Postfix server works just fine for
every other type of mail, sending via mail() wasn't cutting it, but the
PHPMailer and SMTP objects work just fine.

Thanks to everyone who suggested things,

Paul
Jul 17 '05 #6

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

Similar topics

9
710
by: AJ | last post by:
Hi All I've got a little newsletter system that I put together for one of my customers. Basically, it's a table with firstname, lastname and e-mail address. The script then goes through the database, line by line, and sends out a personalised e-mail to the recipient. At the moment, the table is about 1500 odd recrods. When I did the send for the first time, this probably took around 30 minutes to run. Once you click on the send...
3
1938
by: Neal Murphy | last post by:
Howdy! I've encountered an odd error, and it seems to happen only when PHP is used to send email. I'm using PHP 4.1.2 on RH 7.1. The problem is best seen when OS Commerce generates email. Specifically, email that is sent to a local mailbox has the 'F' removed from the "From " header (I think this is the very first character in email messages). With the 'F' missing, the mail file is obviously corrupted. For now, I've resorted to using...
14
22633
by: OldGuy | last post by:
Hi All Sendmail 8.12.11 php 4.3.9 Sendmail is installed and works properly. php is NOT in safemode from the command line; mail user@domain.com < testmsg works fine.
9
2863
by: joealey2003 | last post by:
Hi all... A simple mail example like... <? mail("acco...@yahoo.com","Subject of Message","Message"); ?> does not work to yahoo or spymac.com, but the same works to gmail and other servers.
1
15256
by: Dharmesh Gandhi | last post by:
DB-Library Error 10007: General SQL Server error: Check messages from the SQL Server. CREATE PROCEDURE . ( @srvr varchar(50),
2
2482
by: steve | last post by:
I'm trying to create a PHP script to send mail to a list of addresses. I'm sending mail okay, because the messages arrive in an account that I can check, but messages to a known bad address aren't being bounced back to the sending address. Here's the line of code I'm using: $mailok = mail("me@goodaddress.com,me@badaddress.com","this is a test", "this is a test", "From: me@sendaddress.com");
8
5481
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 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
2
2290
by: Arjen | last post by:
Hello, When I send an e-mail to this sample e-mail address sample@mail.com then there are three options. 1. The e-mail comes over; 2. The e-mail bounce, because the e-mail address doesn't excist; 3. The e-mail bounce, because the e-mail box is full. Is it posible to check these options?
39
3325
by: Viken Karaguesian | last post by:
Hello all, <SIGH> I'm soooooo sick and tired of getting spam e-mails. I'm sure that part of the reson for this is that my e-mail address is publicly available on my website, ready to be picked by e-mail harvesting programs. I tried to thwart them by adding a REMOVE_THIS in my e-mail address (username@REMOVE_THISispname.net), but the e-mails have not stopped. As for NG's, I have the return address blocked in a similar fashion.
0
9586
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
9423
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
10043
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...
0
9861
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6672
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
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.