Solved

Sending email from Dreamweaver Insert Record behavior

Posted on 2009-04-08
3
659 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
  • 2
3 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 125 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

829 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