Page 1 of 1

What's the reverse way of build() and readFull()

Posted: Tue Apr 08, 2008 5:43 am
by s_volenszki
Hi, I'm here again!

I have read a topic on this forum about geting the content of an email in text mode.

Code: Select all

$stream = $message->build();
echo $stream->readFull();
I was wondering, is there any way to make it behindhand? I tell to you why:

I have two tasks, and blissfully they have similar logic to solve.

- First I need to contorll the maximum size (in bytes) of the letter together with inline images and attachments. I think the size check is clear, I make the $stream, write to file and check the size of it.

- Second I have to store the email in text file, but in thet way, the storing happens before making the recipient list, and after it is stored. Later I want to make $message again (form the content of the text file), add the recipients, decorate etc. and send.

Is there any way to do this?

Re: What's the reverse way of build() and readFull()

Posted: Tue Apr 08, 2008 7:05 am
by Chris Corbyn
From what I understand you need to be able to have Swift produce a Swift_Message object based on an existing email. Version 4 will do this* but the current version will only generate content; not parse it.

* Version 4 is to be split into two editions; "Standard" and "Enterprise". The Standard edition has the same features as is currently used, the Enterprise edition has a richer featureset but is not going to be free. Parsing is one of those things which will only be available in the Enterprise version sorry -- it's needed for other features the EE version will offer.

Re: What's the reverse way of build() and readFull()

Posted: Tue Apr 08, 2008 9:26 am
by s_volenszki
If I understand well, than the way to save letters is only this:

- I save the plain text part,
- the html part
- sender, return path etc. as is,

and if the sending is cron operated, than the timed routin has to build the mail as it is described in the documentation.

Re: What's the reverse way of build() and readFull()

Posted: Tue Apr 08, 2008 10:03 am
by Chris Corbyn
That will work yes :)