Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

newsletter signup not working

Status
Not open for further replies.

columbo1977

Programmer
May 9, 2006
49
GB
Can anyone help?

I have a newsletter signup on my site and it doesnt work please find the code below.

mail.php
<?php
$name=$_POST['name'];
$email=$_POST['email'];
$to="chiefscomputerclub@hotmail.com";
$message="$name just filled in your News letter form. Their e-mail address was: $email";
if(mail($to,"Applications From Your Site",$message,"From: $email\n")) {
echo "Thanks for your Application.";
} else {
echo "There was a problem sending the mail. Please check that you filled in the form correctly.";
}
?>

and the code that is in my site is :
<form action="../mail.php" method="post">
<div align="center">Your Name:
<input type="text" name="name">
<br>
E-mail:
<input type="text" name = "email">
<br>
<input type="submit" value="Submit">
</div>
</form>


The error message that I get when i submit it is below :

Warning: Unknown error in c:\webserver\phpdev5\ on line 6
There was a problem sending the mail. Please check that you filled in the form correctly.


Columbo1977
 
On what platform are you running this script? Unix-like OS? Microsoft?

If Microsoft OS, what are the settings in php.ini for SMTP and sendmail_from? If unix-like, what is the setting sendmail_path?



Want the best answers? Ask the best questions! TANSTAAFL!
 
I am on a Windows Xp system and webserver apache sql and php installed.

this is what is in php.ini for the mail:

[mail function]
; For Win32 only.
SMTP = localhost

; For Win32 only.
sendmail_from = me@localhost.com

; For Unix only. You may supply arguments as well (default: 'sendmail -t -i').
;sendmail_path =
 
What do you mean mate, I am new to this and am fumbling my way through. not sure what you mean.

i use outlook express for email?

Columbo1977
 
No. Not mail client. Mail server.

Your Outlook Express ("OE") installation must, in order to send an email, communicate with a mail server. OE hands the message off to the server, which passes it along to (typically) your recipient's mail server, which holds the message in a mailbox until your recipient's mail client fetches it and displays it.

Similarly, PHP's mail() function needs a mail server to pass the message off to. On a unix-like OS, this is rarely a problem, as nearly all of them come with a mail server. On Win32 it's a bit more difficult, as you have to provide one. IIS has a minimal-function mail server built in, but you're running Apache, which does not.

You need to either make a mail server available to PHP or use something that can act as its own mail server. In the latter case, you might look at PHPMailer



Want the best answers? Ask the best questions! TANSTAAFL!
 
it is meant as a statement, the question mark is a bad habit of mine.

I am trying to figure out how to set it up as i am not sure.

Columbo1977
 
sorry dont want to appear thick like but I have put the class things in the php.ini

Looked through the readme file and cant see what to do next.

it doesnt tell you where to put the code that it gives you in the readme.

sorry for being a pain.
 
I don't understand. The README section titled "A Simple Example" text is just a sample script. Where do you put other scripts that you wish to run?



Want the best answers? Ask the best questions! TANSTAAFL!
 
i have the files installed and put the statements in the ini file and now i dont know what to do to get it to send the emails like i origionally wanted.
 
What statements have you put in the ini file?


I'm sorry, but I mispoke. I said earlier that PHPMailer implemented its own SMTP server internally and could be used in places where a mail server was not available. That is not the case.

PHPMailer can only connect to your mail server via SMTP just like Outlook Express can and hand off a message for delivery. PHPMailer is very useful in and of itself, though. It makes sending complex emails, such as HTML emails or emails with attachments, much easier to compose.


Is there no mail server available for use? Can you not use the mail server at your ISP?



Want the best answers? Ask the best questions! TANSTAAFL!
 
think i should give up on that idea then.

all i want to do is have a text field on the site for a user to put in a email address and that address to be sent to me.

what is the easiest way of doing this??

thanks for the advice so far
 
Dont know, but i have used script from a previous website to get it working,

goto : and fill in the newsletter bit on the side. It sends me the email but for some reason it does not goto the thank page? it may be because this site is sitting in some webspace from another site, and the url is just redirected.

what do you think?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top