Solved

Sending email from Dreamweaver Insert Record behavior

Posted on 2009-04-08
3
650 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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.

705 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now