Page 1 of 1

storing emails

Posted: Thu Sep 13, 2007 8:42 am
by gosi
Hi there,

I have read through the forum a bit and found this one:
viewtopic.php?t=66641

Anyhow, let me explain the problem: I create a message and send this one out via swiftmailer,
which works great already but now: I have to move that message into a IMAP folder / database.

So my question is: is there a way to make swiftmailer output the complete created message,
including mime, attachments etc.?


Thanks for your help :)

Re: storing emails

Posted: Thu Sep 13, 2007 1:17 pm
by Chris Corbyn
gosi wrote:Hi there,

I have read through the forum a bit and found this one:
viewtopic.php?t=66641

Anyhow, let me explain the problem: I create a message and send this one out via swiftmailer,
which works great already but now: I have to move that message into a IMAP folder / database.

So my question is: is there a way to make swiftmailer output the complete created message,
including mime, attachments etc.?


Thanks for your help :)
I'd probably suggest using the IMAP functions for this. if you want to see the source code that Swift is about to send you can (almost*) see it with this:

Code: Select all

$stream =& $message->build();
echo $stream->readFull();
* I say almost because the addressing headers (To:, Cc:, Bcc:, From:, Reply-To:) are added during sending.

Posted: Fri Sep 14, 2007 8:20 am
by gosi
thanks for your help, I will try that :)

Posted: Tue Sep 18, 2007 1:49 am
by gosi
Hi!

I switched the whole thing to swift mail now and well it works great.
For adding the to, from, cc, and stuff I use a simple str_replace and
this way the email becomes complete before I push it in via IMAP.

Well, thanks again and I just donated some money .. :)

Posted: Tue Sep 18, 2007 2:23 am
by Chris Corbyn
gosi wrote:Hi!

I switched the whole thing to swift mail now and well it works great.
For adding the to, from, cc, and stuff I use a simple str_replace and
this way the email becomes complete before I push it in via IMAP.

Well, thanks again and I just donated some money .. :)
Ooohh, :) thanks for the donation, much appreciated.

You may get better results using:

$message->setTo()
$message->setFrom()
$message->setReplyTo()

etc etc

The reason I say that is because those methods will deal with things in the RFCs which a simple str_replace() may not do. Sorry, I should have mentioned those methods before. It's these methods which Swift uses when it sends the email.