php - Sending pdf attachment with form using mail() function -
i trying send pdf attachment php mail()
function. not getting how can it. message field in form user editable html editor. without attachment works fine.
here code
<?php include("../connect.php"); include("../admin_auth.php"); ?> <?php if($_post['submit'] == "submit") { $sql = mysql_query("select email users username='admin'"); $row = mysql_fetch_array($sql); $email = $row['email']; $path = $row['path']; $messagealert = "email send successfully!!"; $to = $_post['email']; $from = $email; $headers = "from: " . strip_tags($from) . "\r\n"; $headers .= "reply-to: ". strip_tags($from) . "\r\n"; if($_post['type'] == 2) { $headers .= "mime-version: 1.0\r\n"; $headers .= "content-type: text/html; charset=iso-8859-1\r\n"; } mail($to, $_post['subject'], $_post['message'], $headers); } $message .= ""; $content =$messagealert.'<br> <form method="post" action="" enctype="multipart/form-data"> <table> <tr> <td>email:</td> <td><input type="text" name="email" /></td> </tr> <tr> <td>subject:</td> <td><input type="text" name="subject" /></td> </tr> <tr> <td>message:</td> <td> <div class="w-box" id="n_wysiwg"> <div class="w-box-header"> <h4>wysiwg editor</h4> </div> <div class="w-box-content cnt_no_pad"> <textarea name="message" id="wysiwg_editor" cols="30" rows="10">'.$message.'</textarea> </div> </div> </td> </tr> <tr><td>attachment</td> <td><input type="file" name="attachment" value="netelity.png"></td> </tr> <tr> <td>email type</td> <td><select name="type"> <option value="1">plain</option> <option value="2">html</option> </select></td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" value="submit" /></td> </tr> </table> </form> '; $pre = 1; include("html.inc");
attachment in $path
. tried follow this link, uses $message
static, in code has user input i.e $_post['message']
, did not work.
actually when open form want attachment attached itself.
Comments
Post a Comment