Jump to content


Photo

Send mail


  • Please log in to reply
11 replies to this topic

#1 Stevan

Stevan
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationCoral Springs Fl.

Posted 04 June 2005 - 10:32 PM

I made a form in dreamweaver to send a invoice my customers

How to I make a script to send it it them I know how to me BUT that adress is in the background I wanted to be able to put there email adress in a box and push send


THXS Steve

#2 LexNaturalis

LexNaturalis
  • Members
  • Pip
  • Newbie
  • 1 posts

Posted 05 June 2005 - 02:32 AM

[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]

$to = $_POST[\'email\'];[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

Then just call the mail() function to send the mail to the address that's entered in the form. This assumes the text box is called "email", but you could call it whatever you want.

#3 Stevan

Stevan
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationCoral Springs Fl.

Posted 05 June 2005 - 12:04 PM

I am not sure what you mean I tryed to paste what you said into th eform and it just shows up on the page am i doing something wrong ?? I am very new at this

#4 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 05 June 2005 - 12:27 PM

I am not sure what you mean  I tryed to paste what you said into th eform and it just shows up on the page am i doing something wrong ?? I am very new at this

View Post


like lexnaturalis said, you've got to use the mail() function to get the mail to send. he was simply showing you how to pull the address to use in the mail function. click on the function above to view the php manual page corresponding to this great function.

good luck!
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#5 Stevan

Stevan
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationCoral Springs Fl.

Posted 05 June 2005 - 12:33 PM

Way too complaited for me to understand

Is there any other way to do it?

#6 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 05 June 2005 - 12:39 PM

Way too complaited for me to understand

Is there any other way to do it?

View Post


that's going to be the easiest way... let me see if i can break it down for you:
[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]
[span style=\"color:#0000BB\"]<?php
$to [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\'you@yourdomain.com\'[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#FF8000\"]// the recipient of the email
[/span][span style=\"color:#0000BB\"]$subject [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\'Some Subject\'[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#FF8000\"]// whatever you want to appear in the subject line
[/span][span style=\"color:#0000BB\"]$message [/span][span style=\"color:#007700\"]= \'[/span][span style=\"color:#0000BB\"]Text for message goes here.\"; // message text
mail($to, $subject, $message);
?>
[/span]
[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

that's all there is to it! you have lots of additional "optional" settings that you don't need to worry about at this stage, but to get it to work, all you have to do is provide a To: address, subject, and message.

hope this helps some.

good luck!
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#7 Stevan

Stevan
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationCoral Springs Fl.

Posted 05 June 2005 - 12:48 PM

Ok i made a form box on the page and cut and pasted it into that That is not right as it shows the coding only

Do i have to do something else or a php page or ??



#8 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 05 June 2005 - 01:03 PM

Ok i made a form box on the page and cut and pasted it into that That is not right as it shows the coding only

Do i have to do something else or a php page or ??

View Post

ok, here is the full code for a basic contact form page:
[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]
[span style=\"color:#0000BB\"]<?php
[/span][span style=\"color:#007700\"]if (isset([/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'submit\'[/span][span style=\"color:#007700\"]])) {
  [/span][span style=\"color:#0000BB\"]$to [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\'you@yourdomain.com\'[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#FF8000\"]// replace your address here
  [/span][span style=\"color:#0000BB\"]$subject [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'subject\'[/span][span style=\"color:#007700\"]];
  [/span][span style=\"color:#0000BB\"]$message [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'message\'[/span][span style=\"color:#007700\"]];
  if ([/span][span style=\"color:#0000BB\"]mail[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$to[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$subject[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$message[/span][span style=\"color:#007700\"])) {
    [/span][span style=\"color:#0000BB\"]$message [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\"Mail sent!\"[/span][span style=\"color:#007700\"];
  } else {
    [/span][span style=\"color:#0000BB\"]$message [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\"Couldn\'t send mail!\"[/span][span style=\"color:#007700\"];
  }
}

echo (isset([/span][span style=\"color:#0000BB\"]$message[/span][span style=\"color:#007700\"])) ? [/span][span style=\"color:#0000BB\"]$message [/span][span style=\"color:#007700\"]: [/span][span style=\"color:#DD0000\"]\'\'[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]?>
[/span]
<form name=\'email\' method=\'post\' action=\'\'>
Subject: <input type=\'text\' name=\'subject\' /><br />
Message: <br />
<textarea name=\'message\' cols=\'60\' rows=\'20\'></textarea><br />
<input type=\'submit\' name=\'submit\' value=\'Send It\' />
</form>
[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

this saved with a ".php" extension should allow you to send basic emails through the form.

hope this helps!
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#9 Stevan

Stevan
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationCoral Springs Fl.

Posted 05 June 2005 - 01:10 PM

Ok I did not save it as php so that solves that probelm. The only problem i see is that you have it going to me I need it so i can enter there eamil adreess and send to them


THXS Steve

#10 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 05 June 2005 - 01:15 PM

sounds like you've got it!

good luck!
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#11 Stevan

Stevan
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationCoral Springs Fl.

Posted 05 June 2005 - 01:18 PM

Please How do I change it to send to them I want to send the form to there email adress

STEVE

#12 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 05 June 2005 - 06:04 PM

Please How do I change it to send to them I want to send the form to there email adress

STEVE

View Post


just include a text field to enter their email address into (named 'email' or something like that), then do the following:
[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]
[span style=\"color:#0000BB\"]<?php
[/span][span style=\"color:#FF8000\"]// change this line:
[/span][span style=\"color:#0000BB\"]$to [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\'you@yourdomain.com\'[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#FF8000\"]// to:
[/span][span style=\"color:#0000BB\"]$to [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'email\'[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#0000BB\"]?>
[/span]
[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

that's it.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users