Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Sending email from Dreamweaver Insert Record behavior

Posted on 2009-04-08
3
Medium Priority
?
670 Views
Last Modified: 2013-12-13
Is it difficult to set up and use PHP Mail to send an email when a user updates a record in the Database?
0
Comment
Question by:axessJosh
[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
3 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 500 total points
ID: 24102121
Hi axessJosh,

No.

From the previous question, the insert action happens here:

  $Result1 = mysql_query($insertSQL, $connYOURDB) or die(mysql_error());

  $insertGoTo = "somepage.php";

So you just need to add mail() code in between those lines:

  $Result1 = mysql_query($insertSQL, $connYOURDB) or die(mysql_error());
   
$Name = "Sender";
$email = "email@adress.com";
$recipient = "otheremail@otheremailadress.com";
$mail_body = "Hi";
$subject = "Something"; //subject
$header = "From: ". $Name . " <" . $email . ">\r\n";

mail($recipient, $subject, $mail_body, $header);

  $insertGoTo = "somepage.php";
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 24102132
However, be aware that this will cause the Insert behavior to disappear (or show a red !) in the Behaviors panel.  The code will work, but the extra code breaks DW's syntax check for behaviors.
0
 
LVL 17

Expert Comment

by:houssam_ballout
ID: 24102291
after the update statement, simply use the mail function as jason use in his first post
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

636 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