/    Sign up×
Community /Pin to ProfileBookmark

Hi,

I found a emailer-script on the internet, and modified it so it looked like this:

[code=php]<?
foreach ($_POST as $key => $value) {
$Body = $Body.”$key = $value n “;
}
ini_set (“SMTP”,”my SMPT address”);
mail(“[email protected]”, $_POST[‘Subject’], $Body, “From: Form Responder”);
echo “<meta http-equiv=’refresh’ content=’60;URL=thanks.php>”
?> [/code]

But I get the following error message:

Notice: Undefined variable: Body in C:Program FilesAbyss Web Serverhtdocsmail.php on line 3

Also, my antivirus thingy says:

[QUOTE]

Your email message was unable to be sent because your mail server rejected the message:

451 see [url]http://pobox.com/~djb/docs/smtplf.html.[/url]

[/QUOTE]

All the relevant form elements are on the previous page (the one that when you submit the form goes to my PHP script).

The original script is here:

[url]http://www.stophon4.com/mail/index.htm[/url]

I’m very new to PHP, so sorry if it’s a easy question!

Thanks in advance,

Neil

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@ShrineDesignsJul 07.2004 — it is not nessaccary to do this:[code=php]ini_set("SMTP","my SMPT address");[/code]the host should have this configured properly

i would rewrite the sript like this:[code=php]<?php
$msg = "";

foreach($_POST as $key => $value)
{
$msg .= "$key = $valuen";
}
// the subject of an email can not
// contain: n or r
$sent = mail("[email protected]", trim($_POST['Subject']), $msg);

if($sent !== false)
{
header("Location: thanks.php");
}
else
{
exit("Error: unable to send email!");
}
?>[/code]
Copy linkTweet thisAlerts:
@neil9999authorJul 07.2004 — Thanks for your help!

[i]Originally posted by ShrineDesigns [/i]

[B]it is not nessaccary to do this:[code=php]ini_set("SMTP","my SMPT address");[/code]the host should have this configured properly

[/B][/QUOTE]


I'm the host, and I can't work out how to change it. That solves the undefined variable problem, but I still get the message

Your email message was unable to be sent because your mail server rejected the message:

451 see http://pobox.com/~djb/docs/smtplf.html.[/QUOTE]


Do you know why this is happening?

Also, for some weird reason the header function doesn't work.

Thanks again,

Neil
Copy linkTweet thisAlerts:
@ShrineDesignsJul 07.2004 — you can pick up a smtp server if you need one: http://www.google.com/search?hl=en&ie=UTF-8&q=smtp+server&btnG=Google+Search

the reason why the header() function isn't working is because of the mail() error
Copy linkTweet thisAlerts:
@neil9999authorJul 07.2004 — Thanks for your help, my normal email using the same SMTP works fine, it's just this page that's the problem. Isn't there a way I can do it without installing something completely new? Isn't it just an error with the message it's trying to send?

Also, my server requires authentication, so might it be anything to do with this?

Thanks again,

Neil
Copy linkTweet thisAlerts:
@ShrineDesignsJul 08.2004 — i have never tried to send emails from my local server

you could try an set these directives to your smpt server:

[i]SMTP[/i] Used under Windows only: DNS name or IP address of the SMTP server PHP should use for mail sent with the mail() function.

[i]smtp_port[/i] Used under Windows only: Number of the port to connect to the server specified with the SMTP setting when sending mail with mail(); defaults to 25. Only available since PHP 4.3.0.

if all else fails, try google, lol
Copy linkTweet thisAlerts:
@stophon4Aug 05.2004 — Well, that was my script, thankyou for using it ?

You should also note that you used a meta refresh, though the header would accomplish the same task:
[code=php]
header("Location: thanks.php");
[/PHP}

For it not working though that is a problem with your home server as you have pointed out.
×

Success!

Help @neil9999 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...