Jump to content

jaquelyn

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Everything posted by jaquelyn

  1. I can use this script to send a txt attachment, but not any other type. I can't use it to send a jpeg. The email goes through, only without an attachment if I try to send anything that isn't a text file. Also, the text version of this email doesn't go through, only the html version. I don't particularly mind not being able to send a text email, but it may be a symptom of why I can't send a non-text attachment. Anyway, thanks for reading! <?php require_once "Mail.php"; require_once "Mail\mime.php"; $from = "John Doe <john@doe.com>"; $to = "Jane Doe <jane@doe.com>"; $subject = 'Test'; $headers = array ('From' => $from,'To' => $to, 'Subject' => $subject); $text = 'Text version of email'; // text and html versions of email. $html = '<html><body>HTML version of email. <strong>This should be bold</strong></body></html>'; $file = './logo.jpg'; // attachment $crlf = "\n"; $mime = new Mail_mime($crlf); $mime->setTXTBody($text); $mime->setHTMLBody($html); if($file) $mime->addAttachment($file, 'image/jpeg'); //do not ever try to call these lines in reverse order $body = $mime->get(); $headers = $mime->headers($headers); $host = "mailserver.com"; $port = "25"; $username = "john"; $password = "pass1234"; $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username,'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent!</p>"); } ?> [attachment deleted by admin]
  2. I actually tried that - Doesn't work at all, BUT just found the solution to my problem here: http://dreamweaverforum.info/dreamweaver-general/126952-send-text-entered-mm-dd-yyyy-mysql.html The code snippet to be added is: function UStoMySQL($date) { // split the date on forward slashes $parts = explode('/', $date); // if split successfully, rearrange in the MySQL order if (is_array($parts) && count($parts) == 3) { return "$parts[2]-$parts[0]-$parts[1]"; } else { return false; } } $_POST['fd_date'] = UStoMySQL($_POST['fd_date']); This should be added just above the "if ((isset($_POST..." line. Thanks!
  3. Hi! I'm trying to process a date field on a form where the input is m/d/Y and I can't figure out how to have that entered as the appropriate Y-m-d mysql format. I've tried a thousand things, but I'm doing something wrong. And I can't use a dropdown. Users must be able to enter the date in m/d/Y format. Thank you for any help you can offer! Here is the code: $currentPage = $_SERVER["PHP_SELF"]; $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) { $insertSQL = sprintf("INSERT INTO tbl_timerecords (fd_date, fd_client, fd_task, fd_hours, fd_description, fd_status, fd_notes, fd_user) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['fd_date'],"date"), GetSQLValueString($_POST['fd_client'], "text"), GetSQLValueString($_POST['fd_task'], "text"), GetSQLValueString($_POST['fd_hours'], "double"), GetSQLValueString($_POST['fd_description'], "text"), GetSQLValueString($_POST['fd_status'], "text"), GetSQLValueString($_POST['fd_notes'], "text"), GetSQLValueString($_POST['fd_user'], "text"));
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.