Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Sending Attachments Using Email Function In Php
kvarnerexpress
post Sep 16 2005, 02:10 PM
Post #1


Super Member
*********

Group: Members
Posts: 407
Joined: 13-December 04
Member No.: 2,696



I'm trying to send an attachment using the mail Php function.

It gets caught by the email server with an error. It seems to have a problem with the separator or who knows what. The server says something like "invalid separator on mime type."

The code is:

Code:

CODE
 // subject
$subject  = "Hello There ";

$mime_boundary = "<<<--==-->>>";

       // headers
       $headers  = "From: " . 'Tom' . " <" . 'texample@aol.com' . ">\r\n";
$headers .= "Return-Path: " . 'texample@aol.com' . "\r\n";
$headers .= "Reply-To: " . 'texample@aol.com' . "\r\n";
$headers .= "Content-type: Multipart/Mixed;\r\n";
$headers .= "Mime-Version: 1.0\r\n";
$headers .= "X-Mailer: PHP Mailer\r\n";
$headers .= " boundary=\"".$mime_boundary."\"";

// message
$message .= "This is a multi-part message in MIME format.\r\n";
$message .= "\r\n";
$message .= $mime_boundary."\r\n";

$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
$message .= "Content-Transfer-Encoding: 7bit\r\n";
$message .= "\r\n";
$message  = "Attached is the file ";
$message .= ".";
$message .= "\n\n";
$message .= $mime_boundary."\r\n";

$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
$message .= " name=\"feedback.txt\"\r\n";
$message .= "Content-Description: Requested File;\r\n";
$message .= " filename=\"feedback.txt\"\r\n";
$message .= "\r\n";
$message .= $mime_boundary."\r\n";

       $email = "dianne@aol.com";

// Send
if (mail ($email, $subject, $message, $headers)) {
   echo "<script>alert ('Your email was sent. ')</script>";
   }
else {  
   echo "<script>alert ('Unable to send your email.')</script>";
}  




I'm not trying to use the MimeMail class or anything since
the version of Php that we're using is not supported by it.
I'm just trying to do this using the mail function.

The code seems o.k. when compared to others that I have
seen. Can't figure out what's going on.

Thanks in advance for reading this and any suggestion or
solutions.
kvarnerexpress
Go to the top of the page
 
+Quote Post
round
post Sep 16 2005, 08:27 PM
Post #2


Super Member
*********

Group: Members
Posts: 463
Joined: 8-November 04
Member No.: 2,186



asking a very stupid question but does the sever actually allow you to use mail functions, cause this one doesn't. I mean i have tons of scripts that i've used that work like a charm but you should look to php.net and see if there's anything there that will answer you question or fix your problem.round
Go to the top of the page
 
+Quote Post
moldboy
post Sep 16 2005, 10:46 PM
Post #3


Privileged Member
*********

Group: Members
Posts: 518
Joined: 29-April 05
From: Canada Eh?!?
Member No.: 6,408



What do you mean the mail function isn't on this server? I've sent mail using php from trap17.
Anyway about your question, yes php.net, but more specificaly try:
http://ca3.php.net/manual/en/function.mail.php
scroll down to the part where the users post Vladimir has posted a message that may pertain to you.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Getting List Of Directories And Files Using Php(6)
  2. Trouble With Emailer.php(6)
  3. How To Use A Link To Call Function In Php?(8)
  4. Include File.php?id=something(13)
  5. Wappymail_v1.50(15)
  6. Email Header Inject Test(0)
  7. Explode Function Help(1)
  8. Add Users On Email Program With Php?(1)
  9. How Good Is This Data Cleaning Function?(2)
  10. The Extract() Function(6)
  11. Error With Joomla Template(1)
  12. [php] Header Function(2)
  13. [php](simple) Using Functions To Combine Values In A Form(2)
  14. Email Sending.(1)
  15. Mail() Clone(5)
  1. The Best Zip Function(1)
  2. Sending $_get[] Variables To An Application(3)
  3. Trouble With Phpbb Email(1)
  4. Php Explode Function Help(4)
  5. How To Check If Fsockopen Function Is Enabled?(2)
  6. Arrays Outside A Function(3)
  7. Php Email Validation(1)
  8. An Interesting Approach To Email Verification...(6)
  9. Endif function?(6)
  10. Sending E-mails After News Update?(8)
  11. Sending E-mails Based On Intervals?(7)
  12. PHP Function To Add Previous and Next Page Feature(5)
  13. A Question About Php Mail(1)


 



- Lo-Fi Version Time is now: 6th October 2008 - 11:57 PM