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

Sending mail

Hi,

I'm getting an error when I try sending an email from some code I have
written:

"<?php

print "Thank you, <b>$_POST[name]</b>, for your message!<br><br>\n\n";
print "Your e-mail address is <b>$_POST[email]</b><br><br>\n\n";
print "Your message was:<br><br>\n\n";
print "$_POST[message] <br><br>";

// Start building the mail string
$msg = "Name: $_POST[name]\n";
$msg .= "Email: $_POST[email]\n";
$msg .= "Message: $_POST[message]\n";

// Set up the mail

$recipient = "em**************@bigpond.net.au";
$subject = "Form Submission Results";
$mailheaders = "From: My Web Site <em**************@bigpond.net.au> \n";
$mailheaders .= "Reply-To: $_POST[email]";

// Now we send the mail message
mail ($recipient, $subject, $msg, $mailheaders);
?>
"

The error says:
"
Warning: mail(): SMTP server response: 451 See
http://pobox.com/~djb/docs/smtplf.html. in .......\listing9.12.php on line
28
"

As this web site does not seem to exist does anyone have aby suggestions?
I notice that I don't seem to have provided php with a password anywhere to
access the mail server.
Does it need it?

In my php.ini file I have:

[mail function]
; For Win32 only.
SMTP = mail.bigpond.com
smtp_port = 25

; For Win32 only.
sendmail_from = em**************@bigpond.com

Any Suggestions as th why I get a SMTP server response: 451?
Jul 17 '05 #1
8 5058
Robert <lo*********@yahoo.com.au> wrote:
The error says:
"
Warning: mail(): SMTP server response: 451 See
http://pobox.com/~djb/docs/smtplf.html. in .......\listing9.12.php on line
28
"

As this web site does not seem to exist does anyone have aby suggestions?


Maybe you should learn how to use a searchengine :)

A search for 'smtplf.html' on google turned up:
http://www.google.nl/search?q=cache:...ml+smtplf.html

The cached version of the missing page....

--

Daniel Tryba

Jul 17 '05 #2
I don't know if this is even relevant so please excuse me if it isn't...

You appear to be incorrectly using references to associative arrays, but
maybe it's ok to do it your way and I'm learning something new.

You use $_POST[variable] which should be incorrect. ( ?? )

Instead from the way I learned PHP it's "supposed" to be
$_POST["variable"] or $_POST['variable']

I see others doing it your way too, and it seems to be working but like I
said it shouldn't be that way--maybe I'm wrong... But maybe it's part
of the problem you're having if it isn't passing the right values.

Just my .02...

-DG-

Robert wrote:
Hi,

I'm getting an error when I try sending an email from some code I have
written:

"<?php

print "Thank you, <b>$_POST[name]</b>, for your message!<br><br>\n\n";
print "Your e-mail address is <b>$_POST[email]</b><br><br>\n\n";
print "Your message was:<br><br>\n\n";
print "$_POST[message] <br><br>";

// Start building the mail string
$msg = "Name: $_POST[name]\n";
$msg .= "Email: $_POST[email]\n";
$msg .= "Message: $_POST[message]\n";

// Set up the mail

$recipient = "em**************@bigpond.net.au";
$subject = "Form Submission Results";
$mailheaders = "From: My Web Site <em**************@bigpond.net.au> \n";
$mailheaders .= "Reply-To: $_POST[email]";

// Now we send the mail message
mail ($recipient, $subject, $msg, $mailheaders);
?>
"

The error says:
"
Warning: mail(): SMTP server response: 451 See
http://pobox.com/~djb/docs/smtplf.html. in .......\listing9.12.php on line
28
"

As this web site does not seem to exist does anyone have aby suggestions?
I notice that I don't seem to have provided php with a password anywhere to
access the mail server.
Does it need it?

In my php.ini file I have:

[mail function]
; For Win32 only.
SMTP = mail.bigpond.com
smtp_port = 25

; For Win32 only.
sendmail_from = em**************@bigpond.com

Any Suggestions as th why I get a SMTP server response: 451?


Jul 17 '05 #3
Robert wrote:
$mailheaders = "From: My Web Site <em**************@bigpond.net.au> \n";
$mailheaders .= "Reply-To: $_POST[email]";


Those lines should be like this:

$mailheaders = "From: My Web Site <us**@example.com>\r\n";
$mailheaders .= "Reply-To: $_POST[email]\r\n";

Headers need to end with \r\n not a just \n

--
Justin Koivisto - sp**@koivi.com
http://www.koivi.com
Jul 17 '05 #4
Daniel Tryba wrote:
Robert <lo*********@yahoo.com.au> wrote:
The error says:
"
Warning: mail(): SMTP server response: 451 See
http://pobox.com/~djb/docs/smtplf.html. in .......\listing9.12.php on line
28
"

As this web site does not seem to exist does anyone have aby suggestions?

Maybe you should learn how to use a searchengine :)

A search for 'smtplf.html' on google turned up:
http://www.google.nl/search?q=cache:...ml+smtplf.html

The cached version of the missing page....


maybe next time I'll read the rest of the thread before posting an
answer... ;)

--
Justin Koivisto - sp**@koivi.com
http://www.koivi.com
Jul 17 '05 #5
Data Goob wrote:
I don't know if this is even relevant so please excuse me if it
isn't...

You appear to be incorrectly using references to associative arrays,
but maybe it's ok to do it your way and I'm learning something new.

You use $_POST[variable] which should be incorrect. ( ?? )

Instead from the way I learned PHP it's "supposed" to be
$_POST["variable"] or $_POST['variable']


You're totally correct and it's good that you have noticed it.

The reason why is described here:

http://nl.php.net/manual/en/language...es.array.donts
JW

Jul 17 '05 #6
Janwillem,

Thanks!

I thought there was something wrong with the way people have been doing it,
but this settles it. :-)

( I have been using PHP for 3 yrs now, and am still learning new features... )

-DG-

Janwillem Borleffs wrote:
Data Goob wrote:
I don't know if this is even relevant so please excuse me if it
isn't...

You appear to be incorrectly using references to associative arrays,
but maybe it's ok to do it your way and I'm learning something new.

You use $_POST[variable] which should be incorrect. ( ?? )

Instead from the way I learned PHP it's "supposed" to be
$_POST["variable"] or $_POST['variable']

You're totally correct and it's good that you have noticed it.

The reason why is described here:

http://nl.php.net/manual/en/language...es.array.donts
JW


Jul 17 '05 #7
Hi,

And thank you all for your replies.

I'm going to have to look into this further to find the answer it seems.
I'll let you know how I go.

Thanks
Robert
"Justin Koivisto" <sp**@koivi.com> wrote in message
news:_C*****************@news7.onvoy.net...
Robert wrote:
$mailheaders = "From: My Web Site <em**************@bigpond.net.au> \n";
$mailheaders .= "Reply-To: $_POST[email]";


Those lines should be like this:

$mailheaders = "From: My Web Site <us**@example.com>\r\n";
$mailheaders .= "Reply-To: $_POST[email]\r\n";

Headers need to end with \r\n not a just \n

--
Justin Koivisto - sp**@koivi.com
http://www.koivi.com

Jul 17 '05 #8
On Tue, 14 Sep 2004 17:11:22 GMT, Justin Koivisto <sp**@koivi.com>
wrote:
Robert wrote:
$mailheaders = "From: My Web Site <em**************@bigpond.net.au> \n";
$mailheaders .= "Reply-To: $_POST[email]";


Those lines should be like this:

$mailheaders = "From: My Web Site <us**@example.com>\r\n";
$mailheaders .= "Reply-To: $_POST[email]\r\n";

Headers need to end with \r\n not a just \n

Not sure if this is due to an older version of PHP and a bug in the
mail() function or not, but, granted, that's how they _should_ be, but
I've just had to change a contact form from \r\n to \n as it was
throwing out mail errors:
X-Amavis-Alert: BAD HEADER Improper use of control character (char 0D
hex) in message header 'X-Site'
X-Site: {SITE_URL}\r\n

{SITE_URL} is just a 'sub.domain.tld' string.

PHP v4.2.2 on that box.

Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/
Jul 17 '05 #9

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

Similar topics

0
by: praba kar | last post by:
Dear All, I have doubt regarding mail sending smtplib module. The below code is I used to send a mail. ########################################## import email.Message import email.Utils...
10
by: Stuart Mueller | last post by:
I have an exchange server, that I sometimes use to perform mail shots to clients on our database, these can be upwards of 1000 at a time. As we don't want different clients to see who we are...
2
by: Mr. x | last post by:
Hello, I am sending emails with Hebrew contents. When receiving emails - I cannot see the Hebrew characters (it is not outlook express configuration, because when receiving emails from friends -...
3
by: VB Programmer | last post by:
I have an ASPX page where I send out emails through my mail server mail.MyDomain.com. When I send emails to MyName@MyDomain.com it sends PERFECTLY. When I try sending an email to any other address...
3
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...
1
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to...
2
by: HK | last post by:
In VB.NET, I'm getting the exception "failure sending mail". I'm running VS 2005 on XP Home. This is a new install on a new PC. I've never had email problems with VS 2003, and there I could...
3
by: mfleet1973 | last post by:
Hello Again. I have a program that sends e-mails as follows: Try Dim mail As New MailMessage mail.To = "me@comp.com" mail.From = "me@comp.com mail.Subject = "Test" mail.Body = "Testing123"
9
by: JoeP | last post by:
Hi All, How can I find the reason for such an error: Failure sending mail. Some Code... oMailMessage.IsBodyHtml = False oMailMessage.Body = cEmailBody Dim oSMTP As New SmtpClient...
4
by: =?Utf-8?B?R3V5IENvaGVu?= | last post by:
Hi all I use: Dim message As New MailMessage(txtTo.Text, txtFrom.Text, txtSubject.Text, txtBody.Text) Dim emailClient As New SmtpClient(txtSMTPServer.Text) emailClient.Send(message) And its...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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,...
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...

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.