Solved

Sending email from Dreamweaver Insert Record behavior

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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.
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 …

910 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

16 Experts available now in Live!

Get 1:1 Help Now