tags:

views:

22

answers:

2

I am developing a simple webmail client for IMAP-based email services using PHP's IMAP library, and I was wondering if there was any way to specify the SMTP server to use when sending an outgoing message, so that the message will be placed in the user's Sent mailbox when they are logged into their IMAP account. I saw that their is an imap_mail() function however it looks from the docs like it is just basically an alias for the normal mail() function, or am I wrong in assumming that?

+2  A: 

Why don't you use a full featured class for this function, like PHPMailer?

Vasileios Lourdas
I do use PHPMailer and its a great class, however it does not implement any type of function where an outgoing message is copied to an IMAP sent mailbox, as far as I know.
Bill Dami
+1  A: 

Saving a copy to the Sent Mail folder is a function of IMAP, and is completely unrelated to queuing the message for delivery via SMTP. I.e., your code will have to do both operations separately -- one does not imply the other.

Alex Howansky
Yeah, thats what I figured. So then how would I go about replicating IMAP's function of saving a copy to the sent folder in PHP?
Bill Dami
You just connect to the IMAP server and write the message to the desired folder, presumably via imap_append().
Alex Howansky
Ah never noticed that imap_append() function before, that should do the trick. Thanks :-)
Bill Dami