Jump to content

Send mail


Recommended Posts

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

Link to comment
Share on other sites

[!--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.

Link to comment
Share on other sites

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

239990[/snapback]

 

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!

Link to comment
Share on other sites

Way too complaited for me to understand

 

Is there any other way to do it?

239998[/snapback]

 

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!

Link to comment
Share on other sites

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 ??

240003[/snapback]

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

STEVE

240011[/snapback]

 

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.