I'm writing a script that will get all the new emails in different accounts on the same server, check for keywords and then move each email to different account and folder in that account depending on the keywords found. I've been looking for a simple way to move the emails from one account to another, and to a folder in that account. There doesn't seem to be a simple imap_forward() function. imap_mail_move() only works within the same account. I've been searching the internet for hours looking for a way to do this without having to loop through attachments and fetching each part of the email before sending it to the destination address like I would a new email. I need to make sure no info gets lost during this process and the email arrives at the destination exactly the same as it was initially received. It can look like a forwarded message, that's fine, as long as the attachments, from address and body are intact.
Simple way to forward emails using PHP IMAP
932 Views Asked by Suzanne Edelman At
1
There are 1 best solutions below
Related Questions in PHP
- php Variable name must change in for loop
- register_shutdown_function is not getting called
- Query returning zero rows despite entries existing
- Retrieving *number* pages by page id
- Automatically closing tags in form input?
- How to resize images with PHP PARSE SDK
- how to send email from localhost using codeigniter?
- Mariadb max Error while sending QUERY packet PID
- Multiusers login redirect different page in php
- Imaginary folder when I use "DirectoryIterator" in PHP?
- CodeIgniter + XDebug: debug only working in the main controller, index() function
- PHP script timeout when I use sleep()
- posting javascript populated form to another php page
- AJAX PHP - Reload div after submit
- PHP : How can I check Array in array?
Related Questions in EMAIL
- how to send email from localhost using codeigniter?
- PowerShell EWS Save as for e-mails
- I want to develop an automated email application in asp.net with c#
- Not able to send email in java using SMTP,its blocked by firewall in my office.Is there any other method by which we can send mail?
- Postfix - cannot connect to server to receive email
- PHPMailer send mail with array ( $_POST['email'] )
- Could Not Instantiate Mail Function - PHPMailer - With Attachments - Only Google Chrome
- encrypted email with entrust certificate is not opening with MS Outlook
- Disconnect Client connected to cgi application
- send a message using freemarker
- Using advanced ccs icons in email signatures
- How can I fetch emails on Android?
- Issue with email form and php script
- HTML Control Form with PHP - Errors
- javax.mail.getValidSentAddresses()
Related Questions in IMAP
- How to determine the smtp server save send mails or not?
- Apache Commons Net IMAPsClient List Command
- IP*Works! SearchMailbox for IMAPS returns all available emails, even unmatching
- IMAP search command failed for specific fields
- IMAP Envelope email address format?
- PHP - imap count unseen emails gives always '1' as result
- How to change the subject info of Gmail into Chinese character?
- spring integation and received date issue
- What is the best way to detect character set of an E-Mail message?
- Outlook Importing PST File into IMAP account
- IMAP migration and changes to folder structure
- How to copy email from Gmail to my server using PHP IMAP?
- Time Zone issue in IMAP
- perl office365 imap TLS access not working using IMAPClient
- imap_open showing 500 Internal Server Error in php
Related Questions in PHP-IMAP
- How to Read Only limited E-Mails by IMAP in PHP?
- How can I read an XLSX mail attachment file with PHPExcel?
- Unable to view e-mail attachments on iOS Mail when generated with PHP imap_mail_compose
- No php 7.3 imap module in Ubuntu 18
- Unable to get inbox from gmail using php imap
- Fetching emails after a given UID via PHP imap_search
- How can I use a choosen php.ini file for crontask?
- Php-cli imap_open always asking for a password
- What is the best php option to connect to outlook imap with oAuth?
- Unable to extract Unique Identity for Emails sent from Safaricom Internal Mails ie Message ID (PHP IMAP)
- How can I read emails with Google Gmail?
- Use php-imap classes to parse new mails from server, with Symfony 2.7
- imap_num_msg doesn't return correct amount
- PHP imap_open(): Couldn't open stream to gmail
- PHP IMAP : How to get the correct body?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
If you also have IMAP access to the destination mailbox, you can have two IMAP connections open simultaneously. Use one connection to read the message from the source account and the other to
imap_append()it to the destination account.You'll have to manually re-build the message headers, but that should be pretty simple, looks like you can just do this: