Currently I have an email script which displays a HTML file inline in an email. You can choose to add text to the beginning of the email (ie. before the html file is displayed) For some reason however the text that is meant to go before the html file is being displayed in an attachment of the form AT000xx.txt
If no html file is attached, then the text is displayed fine in the body (but still with attachment copy) If the html file is displayed then the other text is only displayed in the attachment. I deliberatley haven't attached any code to this post, because a) i'm hoping it's a simple MIME type problem or something and b) it's someone elses code I'm working on, read: trying to fix. Thanks.
Unwanted txt file attachment on emails
Moderator: General Moderators
This is how it works:
The class for this is over 300 lines so I won't post (can post specific function etc if required) but you can see the complete class online here:
http://cuib.laborales.unam.mx/publicaciones/Libmail.inc
Code: Select all
$m= new Mail; // create the mail
$m->To( "$to" );
$m->From( "$from" );
$m->Subject( $_POSTї'email_subject'] );
// $email_body gets the contents of the textarea where user can enter additional text, should be displayed before the inline html, instead is being displayed in attachment: ATT000xx.txt
$m->Body( $email_body ); // set the body
//$m->Cc( $email_adds );
$m->Bcc( $email_adds );
$m->Priority(4) ; // set the priority to Low
// inline intructs the mail client to display the HTML if it can
$m->Attach( $html_file_name, "text/html", "inline" );
$m->Send();http://cuib.laborales.unam.mx/publicaciones/Libmail.inc
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
this should work. feyd if im wrong tell me. add there were you put in your own comment
Code: Select all
$open_txt_file = file_get_contents("textfile.txt");
$email_body = $open_txt_file .'<br>'. $email_body;Feyd, yes I have considered this and can get the text to display in the email using your method, however a txt file is still attached to the e-mail which is the main problem.
Shiznatix: There is no text file initially $email_body comes from a textarea ie.
$email_body = $_POST['textarea'];
But then somewhere along the line it gets placed in a text file for attachment, probably because as Feyd suggested it is attaching the html file inline.
Shiznatix: There is no text file initially $email_body comes from a textarea ie.
$email_body = $_POST['textarea'];
But then somewhere along the line it gets placed in a text file for attachment, probably because as Feyd suggested it is attaching the html file inline.