For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > May 2006 > How to send an e-mail file?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to send an e-mail file?

2006-04-30, 6:58 pm

Hello,
I have an e-mail message in txt file. It contains fields
Subject, To, From, Reply-To,Content-Type, X-Mailer and body.
I want to send the file. I tried this way:
mail('','','',$email_read_into_string);
But I got- Warning: mail(): SMTP server response: 503.

I would rather not parse the file to get fields- Subject, To and From as
separate variables and then use them with mail().
Can I send this file AS-IS?

Regards,
Talthen


Colin McKinnon

2006-05-07, 7:01 pm

talthen.z-serwera.o2@nospam.pl wrote:

> Hello,
> I have an e-mail message in txt file. It contains fields
> Subject, To, From, Reply-To,Content-Type, X-Mailer and body.
> I want to send the file. I tried this way:
> mail('','','',$email_read_into_string);
> But I got- Warning: mail(): SMTP server response: 503.
>
> I would rather not parse the file to get fields- Subject, To and From as
> separate variables and then use them with mail().
> Can I send this file AS-IS?
>


The envelope (headers) are handled quite differently from the body part of
an email. How the entities are encapsulates within files and across
conduits varies. But usually in a text file they are seperated by a blank
line (headers come first). You first need to work out the format of your
"txt" file.

You are getting a 503 error probably because you've not put any recipients
in the message and are trying to insert the mystery encoded message as a
header (param4) which cannot contain blank lines rather than sending it in
the body (param3).

If you are running a local MTA then most provide a command line interface
which will allow you to send a message using an envelope embedded in the
same file as the message (e.g. 'sendmail -t').

C.

2006-05-07, 7:01 pm

"Colin McKinnon"
<colin.thisisnotmysurname@ntlworld.deletemeunlessURaBot.com>
> You are getting a 503 error probably because you've not put any recipients
> in the message and are trying to insert the mystery encoded message as a
> header (param4) which cannot contain blank lines rather than sending it in
> the body (param3).


Well... my txt e-mail was copied directly from Outlook Express and then all
the data was changed.
As I was told- to problem was, that PHP on Windows just cannot do
mail('','','',$headers), so I have modified it to
mail($from,$subject,'',$headers) and works this way. Not what I wanted, but
afterall it works...

Regards,
Talthen


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com