Jump to content

sending mail


Recommended Posts

Hi all thats are reading this! i have abig question. It's posible to send a mail from an inbox mail. Example: I send a mail to a friend with a field text in page and a submit button. Can I receive the text from that text fielc in mai email? And how can i do it.

Thanks and excuse for my english.

Link to comment
Share on other sites

Hi all thats are reading this! i have abig question. It's posible to send a mail from an inbox mail. Example: I send a mail to a friend with a field text in page and a submit button. Can I receive the text from that text fielc in mai email? And how can i do it.

Thanks and excuse for my english.

230357[/snapback]

 

Hey,

 

I have a simple answer. I have used the script from this site and rebuild it a bit to my own liking, but it works great. It can send a mail to the administrator and one to the address filled in. So you can see two types of asending mail. To a fixed email address and to the one entered.

 

See this link: http://www.ibdhost.com/contact/

Link to comment
Share on other sites

  • 4 weeks later...
Hey,

 

I have a simple answer. I have used the script from this site and rebuild it a bit to my own liking, but it works great. It can send a mail to the administrator and one to the address filled in. So you can see two types of asending mail. To a fixed email address and to the one entered.

 

See this link: http://www.ibdhost.com/contact/

232330[/snapback]

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>Email Contact Form</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

 

<body>

<?php

 

$master = 'your_email@domain.com';

## Edit this line to include your email

## between the single quotes

 

error_reporting(ALL);

 

if (!isset($_POST['Submit'])) {

echo '<form action="' . $HTTP_SERVER_VARS['PHP_SELF'] . '" method="post" name="email_form" id="email_form">

<table width="100%" border="0" cellspacing="0">

<tr>

<td width="22%">Your Name: </td>

<td width="78%"><input name="name" type="text" id="name" size="30"></td>

</tr>

<tr>

<td>Email Subject:</td>

<td><input name="subject" type="text" id="subject" size="40"></td>

</td>

<tr>

<td>Email to Send to: </td>

<td><input name="to" type="text" id="to" size="40"></td>

</tr>

<tr>

<td>Email Body: </td>

<td><textarea name="body" cols="35" rows="6" id="body"></textarea></td>

</tr>

<tr>

<td>Email to Send from: </td>

<td><input name="from" type="text" id="from" size="40"></td>

</tr>

<tr>

<td>Submit Email: </td>

<td><input type="submit" name="Submit" value="SEND EMAIL!"></td>

</tr>

</table>

</form>';

} else { # Submitted the form

 

$name = $_POST['name'];

$from = $_POST['from'];

$body = $_POST['body'];

$to = $_POST['to'];

$subject = $_POST['subject'];

 

 

if (!isset($_POST['to'])) {

$error = true;

$msg = 'Error: You must specify an address to send the email to.';

} if (!isset($_POST['body'])) {

$error = true;

$msg = 'Error: You must specify a body for the email.';

} if (!isset($_POST['name'])) {

$name = 'anonymous';

} if (!isset($_POST['from'])) {

$from = 'nowhere@site.com';

} if (!isset($_POST['subject'])) {

$subject = '(no subject)';

}

 

$body .= "\n";

$body .= '(This email was sent from ' . $name . ' at ' . $from . ') -- Note: This email was sent via an automated form and this information may not be correct.';

 

if ($error === true) {

echo $msg;

exit;

} else { # No errors

 

$send_mail = mail($to, $subject, $body, "From: $from\nX-Mailer: PHP/ . $phpversion()", "-f $from");

$send_mail_two = mail($master, $subject, $body, "From: $from\nX-Mailer: PHP/ . $phpversion()", "-f $from");

 

if (!$send_mail) {

$msg = 'Error: Email could not be sent at this time.';

} else {

$msg = 'Success! Email was sent.';

}

 

} // End else for if ($error === true)

 

echo $msg;

 

} // End else for if (!isset($_POST['Submit']))

 

?>

</body>

</html>

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.