PHP IMAP fetch partial email message from Email service provider - php

Hello I am using PHP IMAP to retrieve emails from various email-service providers like Gmail, Outlook etc
My question is that usually these service providers in every single Email Body send new message at the top along with email-chain(old-messages/conversation) at the end of the email. Now when I try to retrieve individual email message content I see both the new message content as well as entire conversation content, so my question is there anyway I can distinguish between new message content and conversation
Is there anyway I can use PHP IMAP to find out the new message content in a single email
PS:-
When I say conversation-content I am referring to the entire Email Conversation that gets appended automatically at the end of every email

Related

Undelievered Emails PHP processing - IMAP

I have a website that let users subscribe with their email IDs.
I want to create a cron job that checks the bounced emails via imap connection, and I am using PHP class for that.
The cron job's script supposed to search for emails from "Mail delivery system" and scan the body of the email to detect the invalid email ID in order to mark it in mysql database.
I don't have any problem with IMAP connection or search, but the problem is: I can't find the pattern that the script should look for to define where is the invalid email ID written in the message.
Could you please help me what shall the script look for? (e.g. some word that the email ID will come after or before? Or maybe an HTML tag in the body of the message that carries the invalid email ID)
Thanks for the help

Automatically download .txt file from emails using PHP

I have a messaging service that uses phpmailer class to send emails to SMS using SMTP. I'd like to send to MMS so it will keep all messages in one thread in a user's messaging app; however, when users reply to an MMS thread, the reply comes to my email as a .txt attachment.
I'd like to automatically download the text in the .txt file for every email that comes in and forward the email with the downloaded text to a zapier email parser. If I forward incoming email without first pulling out the text in the .txt file, the zapier parser cannot parse out the information I want. Is there a good mail class that can help me accomplish this?

Can I send email of two differnt message to two different recipient using Mandrill at the same time

In php, I am sending email to users while registering.
Now I want to send one email to admin as well at the same time, But message will be different, like "New registration" to admin and "Thank you for registering" to user.
Is this possible ? I am using Mandrill.
I know about sending email to multiple recipient but the same message not the different.
As per Mandrill API documentation, you can have multiple recipients for a message, but only 1 email/subject.
The easiest solution would be to just make 2 API calls with different message content (1 for the user, one for the admin).
But if you were dead-set on making a single API call, you would need to utilize the message customization feature that allows you to define merge_tags for recipients.
The body/subject would each become a merge tag, and you define the values of merge tags on a per-recipient basis. So you would define a different merge value for the user than for the admin for both the subject & body of the message.
Then Mandrill would substitute the correct subject/body message as it sent.

Label Outgoing email in Gmail

I'm working on a PHP application that uses CakePHP and I want to send an email from a GMail inbox that includes a email label.
As an example: I have the label 'work' in my GMail inbox, I need the php application to append the work label to an email message and then send that message.
I am using SMTP via CakePHP's email library to send this email from the gmail inbox. I am not sure if it is possible to append a label using these tools. Does anyone know if this can be done?
Labels are an internal GMail mechanism and as such not part of the email protocol or anything of the like. GMail labels incoming emails based on user-defined filters, e.g. mails coming from a certain address or containing certain words or phrases.
If you want to label certain emails with certain tags, then you need to create the rules in your GMail, and then send out emails following these rules.
For instance, you could create a rule applying the tag 'work' to every email coming from CakePHP's email address with the word [work] in the title, and then send emails like that.
An alternative and somewhat more fancy solution would be to make use of GMail's plus-aliasing. Assuming your email is yourname#gmail.com, all emails going to yousername+something#gmail.com will also arrive in your inbox. Therefore, you could send mails to yourname+work#gmail.com and create a filter for those in GMail.

Access only current portion of email

I am using the imap_xxxx functions to read the emails body. My problem is to find out only the current portion of the email body not the complete email. When user reply for an email it not only contains the his response but the complete mail chain. I know that facebook does it (or may be many other sites also) but how...

Categories