Hello group,
I've got a script here that sends emails with an attachment to
an email address that is retrieved from an html form. The
email sending code is include below.
The problem: when sending the email to certain email servers,
the attachment section of the email gets removed and I end up
with an attachment of zero kb. Other servers do accept the
attachment as expected.
This might seem to be server-related, but when I send a
regular email with attachment (not with the php code) to the
problem servers, nothing irregular happens and the attachment
stays intact. So the problem must be with the email generating
code, but I don't seem to be able to isolate it...
Anyone who can shed a light on this?
Thanks in advance,
Wald
-- email sending code ---------------------------------------
function sendmsg($to, $subject, $msgtext, $from, $file, $type)
{
$fp = fopen($file,"rb");
$fcontent = fread($fp ,filesize($file));
fclose($fp);
$content = chunk_split(base64_encode($fcontent));
$sep = strtoupper(md5(uniqid(time())));
$name = basename($file);
$header = "From: $from\nReply-To: $from\n";
$header .= "MIME-Version: 1.0\n";
$header .= "Content-Type: multipart/mixed; boundary=$sep
\n";
$body .= "--$sep\n";
$body .= "Content-Type: text/plain\n";
$body .= "Content-Transfer-Encoding: 8bit\n\n";
$body .= "$msgtext\n";
$body .= "--$sep\n";
$body .= "Content-Type: $type; name=\"$file\"\n";
$body .= "Content-Transfer-Encoding: base64\n";
$body .= "Content-Disposition: attachment; filename=
\"$file
\"\n";
$body .= "$content\n";
$body .= "--$sep--";
if (mail($to, $subject, $body, $header)) {
return true;
} else {
return false;
}
} 4 26655
Wald <arnout.standaert@n-o_s-p-a-m.cit.kuleuven.ac.be> wrote: Hello group,
I've got a script here that sends emails with an attachment to an email address that is retrieved from an html form. The email sending code is include below.
The problem: when sending the email to certain email servers, the attachment section of the email gets removed and I end up with an attachment of zero kb. Other servers do accept the attachment as expected.
Just to let you know guys, even the smallest of clues might help
here!
Thanks,
Wald
On Tue, 08 Jul 2003 14:58:17 +0000, Wald wrote: Wald <arnout.standaert@n-o_s-p-a-m.cit.kuleuven.ac.be> wrote:
Hello group,
I've got a script here that sends emails with an attachment to an email address that is retrieved from an html form. The email sending code is include below.
The problem: when sending the email to certain email servers, the attachment section of the email gets removed and I end up with an attachment of zero kb. Other servers do accept the attachment as expected.
Just to let you know guys, even the smallest of clues might help here!
Thanks, Wald
Try copying the headers off the email that works. Copy them *exactly*.
Paste into PHP script.
Test email.
later...
--
Jeffrey D. Silverman | jeffrey AT jhu DOT edu
Johns Hopkins University | Baltimore, MD
Website | http://www.wse.jhu.edu/newtnotes/
"Jeffrey Silverman" <je*****@jhu.edu> wrote: On Tue, 08 Jul 2003 14:58:17 +0000, Wald wrote:
Wald <arnout.standaert@n-o_s-p-a-m.cit.kuleuven.ac.be> wrote: I've got a script here that sends emails with an attachment to an email address that is retrieved from an html form. The email sending code is include below.
The problem: when sending the email to certain email servers, the attachment section of the email gets removed and I end up with an attachment of zero kb. Other servers do accept the attachment as expected.
Try copying the headers off the email that works. Copy them *exactly*.
Paste into PHP script.
Test email.
Argh. This ended up being a problem with line endings. CRLF endings
are apparently needed after MIME separator lines, I only provided
one single \n.
Anyway, thanks for the moral support ;-)
Wald
On Wed, 09 Jul 2003 13:11:38 +0000, Wald wrote:
<snip!> Argh. This ended up being a problem with line endings. CRLF endings are apparently needed after MIME separator lines, I only provided one single \n.
Anyway, thanks for the moral support ;-)
Wald
And thanks for describing what the problem turned out to be. Too many
threads end without reconciliation...
--
Jeffrey D. Silverman | jeffrey AT jhu DOT edu
Johns Hopkins University | Baltimore, MD
Website | http://www.wse.jhu.edu/newtnotes/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: abracad |
last post by:
I'd like to add a form that will email a file attachment to me.
Can anyone recommend a decent free script?
Thanks
|
by: Paul Schmidt |
last post by:
Dear list:
I am new to python, and I am trying to figure out the short answer on
something.
I want to open a POP3 mailbox, read the enclosed mail using the POP3
module, , and then process it...
|
by: Martin Körner |
last post by:
Hi NG,
I am using email module for creating mails with attachment (and then
sending via smtplib).
If the name of the attachment file is longer than about 60 characters
the filename is wrapped...
|
by: morphex |
last post by:
Hi,
I have an email that's in the utf-8 encoding, and I'm getting this
error message when I try to send it using smtplib:
* Module smtplib, line 688, in sendmail
* Module smtplib, line 485,...
|
by: =?Utf-8?B?SHVnaA==?= |
last post by:
Hi There,
I use follow code to send email inside VB.NET 2005. It does not work well.
Error message of "Failure sending email" would occue. However, email was
sent out sometimes. I am confused...
|
by: erikcw |
last post by:
Hi all,
I'm trying to extract zip file (containing an xml file) from an email
so I can process it. But I'm running up against some brick walls.
I've been googling and reading all afternoon, and...
|
by: Paridevi |
last post by:
Hai ,
i want to send email in .Net Using OutLook Express,My Project is Web Application using vb.Net 2003 with SQL Server 2000.I have searched a lot in Google, but ican't get any...
|
by: jambonjamasb |
last post by:
Hi
I have two tables:
email_tbl
Data_table
Data table is is used to create a Form
Data_form
|
by: tourerukcom |
last post by:
Hi
i wonder if any one can help. I have script that that sends a email
with mulitple attachments. It seems to work fine as i get the email
with the attachments on. But other people i send it to...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |