Commit | Line | Data |
---|---|---|
c4f9ed02 PM |
1 | <?PHP |
2 | include_once('../email.php'); | |
64feb164 | 3 | |
c4f9ed02 PM |
4 | $base_message = "I just wanted to take a second and follow up with your visit to md-petition.com and see if you needed anything, or had any questions."; |
5 | ||
6 | // USAGE meps_mail('Patrick <baltimorehacker@gmail.com>','','Petition Follow-Up'); | |
7 | ||
64feb164 | 8 | $q="SELECT * FROM follow_up where status = 'NEW'"; |
c4f9ed02 PM |
9 | $r = $petition->query($q); |
10 | while($d = mysqli_fetch_array($r)){ | |
64feb164 PM |
11 | $name = $d['name']; |
12 | $email = $d['email']; | |
13 | ||
14 | $q2 = "SELECT * FROM presign where php_session_id = '$d[php_session]'"; | |
15 | $r2 = $petition->query($q2); | |
16 | $presign = mysqli_fetch_array($r2); | |
17 | ||
18 | $visit = $presign['action_on']; | |
19 | ||
20 | $q2 = "SELECT * FROM petitions where petition_id = '$d[petition_id]'"; | |
21 | $r2 = $petition->query($q2); | |
22 | $petitions = mysqli_fetch_array($r2); | |
23 | ||
24 | $petition_name = $petitions['petition_name']; | |
25 | $landing_page = $petitions['landing_page']; | |
26 | $web_short_name = $petitions['web_short_name']; | |
27 | ||
28 | $link = 'https://www.md-petition.com/?invite='.$web_short_name; | |
29 | if ($landing_page != ''){ | |
30 | $link = 'https://www.md-petition.com/'.$landing_page; | |
31 | } | |
32 | ||
33 | $invite = "<br><br>Petition: $petition_name at <a href='$link'>$link</a>"; | |
34 | $last = "<br><br>Follow up was requested at $visit"; | |
35 | $body = $base_message.$invite.$last; | |
36 | $subject = "$petition_name Petition Follow-Up"; | |
37 | $to = "$name <$email>"; | |
38 | $feedback_message = "TO: $to SUB: $subject MSG: $body sent on ".date('r')." by ".$_COOKIE['name']; | |
850093f5 | 39 | meps_mail($to,$body,$subject); |
64feb164 | 40 | $feedback_message = $petition->real_escape_string($feedback_message); |
850093f5 | 41 | $petition->query("update follow_up set status = 'sent', feedback_message = '$feedback_message' where id = '$d[id]' "); |
c4f9ed02 PM |
42 | } |
43 | ||
44 | ?> |