View previous topic :: View next topic |
Author |
Message |
Seeker Guest
|
Posted: Wed May 15, 2002 1:42 am Post subject: Windows SendMail suggestions? |
|
|
Anyone here want to suggest a SendMail program for Windows that you don't need to have a doctorate in computer science to install/run/use?
Sorry but looking at the two examples in a previous post left me more confused than I thought possible. One comes with 0 documentation and the other is polluted with stuff I sure cannot figure out! 8O
It bwas mentioned that there were "many" but my Internet searches don't find many at all. |
|
Back to top |
|
|
TheLinker -
Joined: 05 Apr 2002 Posts: 165 Location: Oslo, Norway
|
|
Back to top |
|
|
Seeker Guest
|
Posted: Wed May 15, 2002 2:43 pm Post subject: Re: Windows SendMail suggestions? |
|
|
TheLinker wrote: |
I don't know if this is relevant, but if you are trying to send mail from PHP or Perl scripts... you can use the built-in mail functions...
|
You da MAN Linker! I really appreciate the links!
However....am I missing something here? What do you mean by "built-in mail functions" ? Yes, I would like to run FormMail (Matt's) in Perl, but I need SendMail to do it. I have Active Perl installed. |
|
Back to top |
|
|
TheLinker -
Joined: 05 Apr 2002 Posts: 165 Location: Oslo, Norway
|
Posted: Wed May 15, 2002 5:49 pm Post subject: Re: Windows SendMail suggestions? |
|
|
Seeker wrote: | TheLinker wrote: |
I don't know if this is relevant, but if you are trying to send mail from PHP or Perl scripts... you can use the built-in mail functions...
|
However....am I missing something here? What do you mean by "built-in mail functions" ? Yes, I would like to run FormMail (Matt's) in Perl, but I need SendMail to do it. I have Active Perl installed. |
Okey... I don't know too much about how to solve this in Perl, but using PHP scripts is very easy... First you need to install PHP as described by aprelium somewhere else on this web site...
Then make a file called formmail.html with the following contents:
Code: |
<html>
<head>
<title>Feedback Page</title>
</head>
<body>
<div align="center">
<form action="formmail.php" method="post">
<h3>Subject</h3><input type="text" name="Subject" size="60">
<h3>Message</h3><textarea cols="60" rows="20" name="Article"></textarea>
<br><br>
<input type="submit" value="Send E-Mail"><input type="Reset">
</form>
</div>
</body>
</html>
|
Now you need the formmail script. Make a file called formmail.php with the following contents:
Code: |
<?php
$To_EMail = "to@company.com";
$From_EMail = "from@company.com";
if ( mail( $To_EMail, $_POST["Subject"], $_POST["Article"], "From: ".$From_EMail."\nReply-To: ".$From_EMail."\nX-Mailer: PHP/".phpversion() ) )
{
echo "OK";
}
?>
|
Change the $To_EMail and $From_EMail variables to what you want. If everything is done correctly, you should see a simple html-page where you can insert the SUBJECT and MESSAGE for the e-mail. The mail will be sent to your $To_EMail. After the e-mail is sent, you should see the text OK in your browser.
Now, remember... this is a very simple formmail example... :) |
|
Back to top |
|
|
Seeker Guest
|
Posted: Thu May 16, 2002 10:58 pm Post subject: RE: Windows SendMail suggestions |
|
|
Muchos gracias The Linker!
That'll be great info for others I'm sure...I just don't feel like installing PHP until I have more need for it (ie: PHP scipts, etc.).
I did find Jgaa's little sendmail program to work extremely well though for my purposes. I never thought of looking at his page although I got my War FTP Daemon there long ago. |
|
Back to top |
|
|
James Guest
|
Posted: Fri May 24, 2002 10:42 am Post subject: How can I do this? |
|
|
TheLinker,
First off, your script works great. I've never used php before, but I managed to customize it a bit and still have it work. Lets say I made the html page have 3 text boxes - lets name them 1, 2, & 3. Now, how would I have to customize the php to have it so that 1, 2, & 3 would be in the email message.
Example:
Subject: [whatever the person entered]
Message:
1: whatever the person wrote
2: whatever the person wrote
3: whatever the person wrote
Thanks,
James |
|
Back to top |
|
|
TheLinker -
Joined: 05 Apr 2002 Posts: 165 Location: Oslo, Norway
|
Posted: Fri May 24, 2002 1:16 pm Post subject: Re: How can I do this? |
|
|
James wrote: |
Lets say I made the html page have 3 text boxes - lets name them 1, 2, & 3. Now, how would I have to customize the php to have it so that 1, 2, & 3 would be in the email message.
Example:
Subject: [whatever the person entered]
Message:
1: whatever the person wrote
2: whatever the person wrote
3: whatever the person wrote
|
Hi James...
What you can do, is to collect the information from those textboxes and add them to one variable... something like this:
Code: |
<?php
$To_EMail = "to@company.com";
$From_EMail = "from@company.com";
$Message1 = "1: ".$_POST["1"];
$Message2 = "2: ".$_POST["2"];
$Message3 = "3: ".$_POST["3"];
$Message = Message1."\n".Message2."\n".Message3;
if ( mail( $To_EMail, $_POST["Subject"], $Message, "From: ".$From_EMail."\nReply-To: ".$From_EMail."\nX-Mailer: PHP/".phpversion() ) )
{
echo "OK";
}
?>
|
I think this would work. I'm answering this message from a place where I can't test PHP codes... :)
Again... this code is not optimized in any way... :D |
|
Back to top |
|
|
James Guest
|
Posted: Fri May 24, 2002 3:43 pm Post subject: |
|
|
I can't get that one to work. Here's what I did:
formmail1.html
Code: | <html>
<head>
<title>Feedback Page</title>
</head>
<body>
<div align="center">
<form action="formmail1.php" method="post">
<h3>Subject</h3><input type="text" name="Subject" size="60">
<h3>Message</h3><textarea cols="60" rows="20" name="1"></textarea>
<br><br>
<h3>Message</h3><textarea cols="60" rows="20" name="2"></textarea>
<br><br>
<h3>Message</h3><textarea cols="60" rows="20" name="3"></textarea>
<br><br>
<input type="submit" value="Send E-Mail"><input type="Reset">
</form>
</div>
</body>
</html> |
formmail1.php
Code: | <?php
$To_EMail = "james193@optonline.net";
$From_EMail = "formmail@bayoneweb.com";
$Message1 = "1: ".$_POST["1"];
$Message2 = "2: ".$_POST["2"];
$Message3 = "3: ".$_POST["3"];
$Message = Message1."\n".Message2."\n".Message3;
if ( mail( $To_EMail, $_POST["Subject"], $Message, "From: ".$From_EMail."\nReply-To: ".$From_EMail."\nX-Mailer: PHP/".phpversion() ) )
{
echo "OK";
}
?> |
I go to formmail1.html and I type Test in the subject, Hello in 1, Goodbye in 2, and HAHA in 3. I get this error message:
Code: | Notice: Use of undefined constant Message1 - assumed 'Message1' in C:\Program Files\Abyss Web Server\htdocs\formmail1.php on line 10
Notice: Use of undefined constant Message2 - assumed 'Message2' in C:\Program Files\Abyss Web Server\htdocs\formmail1.php on line 10
Notice: Use of undefined constant Message3 - assumed 'Message3' in C:\Program Files\Abyss Web Server\htdocs\formmail1.php on line 10
OK |
I recieve this email:
Code: | From: <formmail@bayoneweb.com>
To: <james193@optonline.net>
Subject: Test
Date: Friday, May 24, 2002 10:34 AM
Message1
Message2
Message3 |
Any suggestions?[/code] |
|
Back to top |
|
|
TheLinker -
Joined: 05 Apr 2002 Posts: 165 Location: Oslo, Norway
|
Posted: Fri May 24, 2002 6:32 pm Post subject: |
|
|
I was a to quick with this code... :)
Locate the following line:
$Message = Message1."\n".Message2."\n".Message3;
This should read:
$Message = $Message1."\n".$Message2."\n".$Message3; |
|
Back to top |
|
|
Guest
|
Posted: Sat May 25, 2002 12:33 am Post subject: |
|
|
Great! One final quesiton. If I wanted to change 1, 2 & 3 to words instead of numbers, what would I have to do. Lets use the words one, two and three. |
|
Back to top |
|
|
TheLinker -
Joined: 05 Apr 2002 Posts: 165 Location: Oslo, Norway
|
Posted: Sat May 25, 2002 8:14 am Post subject: |
|
|
Anonymous wrote: | If I wanted to change 1, 2 & 3 to words instead of numbers, what would I have to do. Lets use the words one, two and three. |
Then you can do the following:
Code: |
$Message1 = "One: ".$_POST["1"];
$Message2 = "Two: ".$_POST["2"];
$Message3 = "Three: ".$_POST["3"];
$Message = $Message1."\n".$Message2."\n".$Message3;
|
As you can see, the $_POST["1"] is your PHP code, is a reference to the <textarea cols="60" rows="20" name="1"> line in your HTML code... or more specific the name variable in line from HTML.
So if I change the name variable to something else, like the following changes in the HTML code...
<textarea cols="60" rows="20" name="textarea1">
Then I must do the following changes in the PHP code...
$Message1 = "One: ".$_POST["textarea1"];
Regards... 8) |
|
Back to top |
|
|
E-Oreo. Guest
|
Posted: Tue May 28, 2002 8:32 pm Post subject: Ok |
|
|
So to run that script all we need is the web server and php installed? we don't need any SMTP servers or anything like that?
kool, is there any way to do that with perl? |
|
Back to top |
|
|
TheLinker -
Joined: 05 Apr 2002 Posts: 165 Location: Oslo, Norway
|
Posted: Tue May 28, 2002 10:29 pm Post subject: Re: Ok |
|
|
E-Oreo. wrote: | So to run that script all we need is the web server and php installed? we don't need any SMTP servers or anything like that?
kool, is there any way to do that with perl? |
You must add the SMTP server in the PHP.ini ... Like you do for your e-mail program... Other than that, everything works fine...
I don't know what solutions exists for Perl, but I guess there is a Perl module doing the same ... |
|
Back to top |
|
|
Crash -
Joined: 05 Apr 2002 Posts: 10
|
Posted: Wed May 29, 2002 1:23 am Post subject: Wow! |
|
|
Wow I've learnt more PHP in the 2 minutes it took to read this topic than I've learnt ever! :lol:
Nice one Linker m8 :wink: |
|
Back to top |
|
|
TheLinker -
Joined: 05 Apr 2002 Posts: 165 Location: Oslo, Norway
|
Posted: Wed May 29, 2002 3:25 pm Post subject: Re: Wow! |
|
|
Thank you... 8) |
|
Back to top |
|
|
|