Store sent mails using PHPMailer into Office365 account - email

I've started using PHPMailer with an Office365 account and by now it works fine sending emails through SMTP. Anyway I need to store the sent emails, so I've tried #DavidRockin's code but I'm unable to make it store sent emails into the 'Sent items' folder (only the inbox works). Any help?

You need to check if the sent folder exist and the correct name, it can have a similar meaning but different spelling.
First, use php_imap to get a list of folders, the one used for storing sent emails can be used with imap_append method

Related

Email succesfully sent but not appear in Sent Items (Microsoft 365)

Hi Good day to everyone here.
My first questions, here we go but i'll try to explain it the best way I could.
I develop auto sending email features using javaxmail in my application for my customer.
Previously when using setting smtp.office365.com I able to send email and the copies of sent email are display in Sent Items folder.
Recently when there are hiccup with smtp office (time out frequently), the IT department at my customer change the setting to use local server instead for smtp (with ip address 172.162.etc.etc). However since the start using this new setting, the email no longer appear in Sent Items but the email still able to sent out ( I test sending email to myself and able to received it ).
Since Im not really familiar and have very limited knowledge on server side for mail server, is there anything I can suggest to the IT department to check for? I only can login the email account on web (https://outlook.office.com/mail/) but when using outlook it required authentication. With web mail i already go thru all settings available and didn't see anything related.
Thanks in advance. Sorry if the question confusing and misleading.
Well, of course - your local SMTP server knows absolutely nothing about your remote Exchange mailbox. It cannot possibly place anything in your Sent Items folder.
You need to send using your Exchange Server - its SMTP server does place sent messages in the Sent Items folder owned by the authenticated user. Keep in mind that MS has recently disabled basic auth in M365. You need to re-enable it for your tenant and the particular mailbox used to send messages.

Do email servers have standard folder naming or ids?

I'm trying to append sent emails to the "Sent" folder in different email accounts running in different servers (yahoo, gmail, outlook, etc.)
For that purpose, I'm using the imap_append function where I have to give the name of the folder I want to append the emails.
The problem is that every account has different folder naming and languages. For example, Gmail has [Gmail]\Sent, a Spanish Yahoo account has Enviados, etc.
Is there a solution for this? I have tried to send the emails to INBOX.Sent but not working at all.
Is the only solution asking the user to define his "Sent" folder?
Edit:
I have checked the tags for the [Gmail]\Sent folder in a Gmail account and I don't know why it has no \Sent flag defined. How are mail clients supposed to know that the sent emails should be copied here?

PHPMailer hosting site using 123-reg

basically I'm hosting my site on 123-reg and have a contact form on my site which i want people to send me emails to my live.co.uk email address, i was using the basic php mail() but found all emails are constantly going into junk folder which i rather it go into inbox so was told to use phpmailer
looking into phpmailer i get to the code which asks for smtp but I'm lost with this as I'm not sure what i should be putting for the host username and password as i want the website to send emails to a given email address , any advice on what i should be putting this and why would be great
Thank You
You don't need to use SMTP - you can use a local mail server and call isMail() instead of isSMTP() - though you don't even need to do that since it's the default. In the examples folder provided with PHPMailer, look at the one called mail.phps.

Send mail without saving in users sent items

Is it possible to send mail without saving a copy in the user's sent items? I am using MFMessage framework.
NO if you want to use MFMessage framework, it is not possible to send email without sending in user's sent items.
BTW why would you like to do this ? Any way, if you are using user's account, you CANT.
But then if you want an email to be sent, use smtp and other account, that is highly undesirable

Can't receive emails send from php

I have set up several email accounts on my vps hosting but I can't receive any emails that are send via php from another hosting. Everything works fine when I send emails from gmail for example, I receive them without a trouble. Does anyone know any reason why emails sent from php can't be received?
Try using phpmailer, it's a good mailing class which automatically sets well defined headers so that the mail is more likely to not land in the spam folder.
Sounds like a spam filter issue. Have you set up a proper Sender ID/SPF framework in your domain name service so that the host appears to be a valid MTA for this domain? Look here for a detailed explanation of Sender ID/SPF/DKIM, etc.
Check your spam folder.
GMail is able to differenciate if a mail has been sent from outlook for example or an automated application. (I dont know how, but they can). If i send an email from my work account to GMAil works, if its a web app or executable with the same email adress, it ends up on the spam folder.