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

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
s_volenszki
Forum Newbie
Posts: 6
Joined: Tue Apr 08, 2008 1:14 am

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

Post 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?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

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

Post 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.
s_volenszki
Forum Newbie
Posts: 6
Joined: Tue Apr 08, 2008 1:14 am

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

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

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

Post by Chris Corbyn »

That will work yes :)
Post Reply