Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

simple script to send out an email when user clicks a button...

Posted on 2004-08-23
5
Medium Priority
?
183 Views
Last Modified: 2010-08-05
Hi,

I am trying to make a page that I will have a friend visit and will send them an email from me.

When they go to the page. there will be a "submit" button... when they click on that it will mail out an email to their address (something I already defined in the code itself... allthat page has is a button).

so i want them to click that button and I want a pre-programmed email to go out.

i was wondering how i can do this... i have a webserver compatible with most web languages.

it doesnt have to be anythin fancy... the body of hte message can even be encoded in hidden fields on the page itself... all the sameto me.

thanx in advanced for the help!

0
Comment
Question by:damn_computer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 

Author Comment

by:damn_computer
ID: 11876105
nevermind... i found it here:

http://email.about.com/cs/phpemailtips/qt/et031202.htm

now how do i configure my server so it doesnt say from: "Nobody" and it says my name instead... or even better... is there somehting I can add to the code from there to make it say that?

<?php
$to = "email.guide@about.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body))
{
   echo("<p>Message sent!</p>");
}
else
{
   echo("<p>Message delivery failed...</p>");
}
?>

0
 
LVL 11

Expert Comment

by:neester
ID: 11877079
Hey DamnComputer,

Easy,

<?php
$to = "email.guide@about.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$header = "from: whoeveryouare@whateverdomain.com\n";
if (mail($to, $subject, $body,$header))
{
   echo("<p>Message sent!</p>");
}
else
{
   echo("<p>Message delivery failed...</p>");
}
?>


That should work jsut fine
0
 
LVL 11

Accepted Solution

by:
neester earned 240 total points
ID: 11877093
IF YOU WANT TO MAKE THE EMAIL HTML USE THIS ONE...



<?php
$YOUREMAIL = 'whoeveryouare@whateverdomain.com';

$to = "email.guide@about.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$header = "From: $YOUREMAIL\r\n";
$header .= "X-Sender: $YOUREMAIL\r\n";
$header .= "Content-type: text/html\r\n";
if (mail($to, $subject, $body,$header))
{
   echo("<p>Message sent!</p>");
}
else
{
   echo("<p>Message delivery failed...</p>");
}
?>




That should work just fine!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question