Forward email with IMAP

the mail() function

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Fri Oct 10, 2008 8:58 am

Forward email with IMAP

Postby zsedc » Fri Oct 10, 2008 9:05 am


I am trying to make a short code to forward messages.
I am looking for simple way to forward emails (also HTML and attachments) with IMAP (or POP3) using PHP. There must be the possibility to do it within a few lines of code - i could not find.

I do not think that there is a code to write.
There is probably only one line of code required to do this.

The code i have:

$num is a message number

Code: Select all

$link=imap_open("{}INBOX", $PHP_AUTH_USER, $PHP_AUTH_PW);

Now I would like to use standard Unix function mail() to send this email, so it will be forwarded.

Code: Select all

mail('', 'any subject', $body, $header)

It works for plain text messages, but I do not know how to do it when there is HTML or attachments? I guess there is a problem with $header. I was also trying imap_mail_compose() or imap_mail(),but I didn't get any successful solution.

Does any one could help?

Thanks a lot


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest