Automatically add attachmends based on input field - phpmailer

I would like to know if there is a way to automatically add attachments in my PHPMailer script based on the value of input field.
Example:
I have a folder named Stackoverflow.com on my desktop and I would like to add all the attachments from that folder as soon as I type in Stackoverflow.com in my subject input.

No. A script running in a web browser has no direct access to your local files. Many years ago browsers used to allow this, but it (unsurprisingly) turned out to be catastrophically bad from a security perspective. You can select multiple files yourself via a normal file input, but it is up to you to select them, not the code running in the page. Also, this has nothing to do with PHPMailer.

Related

Gmail - Link to Draft in non-conversation view

I am importing/creating drafts in Gmail using the Gmail API. After creation I'd like to redirect the user to the Gmail UI with the opened Draft in the composer window.
I made it work properly for https://mail.google.com/mail/#drafts?compose=[MESSAGE ID]. Other urls I found here also worked well. Gmail is doing some redirects and eventually the composer window is opened with the draft.
Now my issue:
If the user has not enabled "Conversation view" this will not work at all. The redirect will then result in https://mail.google.com/mail/u/0/#drafts?compose=new and only an empty, new composer window is shown and a new draft is created by the UI.
If I open the draft directly the ID-format is different. https://mail.google.com/mail/u/0/#drafts?compose=hJzgZpSqgLQcCWgZqnlNRzRBfMbjZVnZklzvcFxhQCdwT... and I have no idea if this format can be generated somehow.
Does anybody has an idea or experience to also make it work with this UI setting. How I can force Gmail to load the draft into the composer window?
Thanks in advance.
If you have Email Threading > Conversation View enabled
Make use of the following URL
https://mail.google.com/mail/u/0/#inbox?compose=DRAFT_MESSAGE_ID
If you have disabled the Email Threading > Conversation View option
Make use of the following URL
https://mail.google.com/mail/u/0/#inbox/DRAFT_MESSAGE_ID
Additional information
The main difference between them is that the first is treated as a conversation while the second example is not.
You can use #drafts instead of #inbox in the URL.
The number after .../mail/u/ is the session you have opened
You can retrieve the DRAFT_MESSAGE_ID by making a request to the API
You can approximately generate the compose ID by yourself, there are some examples out there (not recommended). I strongly recommend you to use the DRAFT_MESSAGE_ID instead.
This appears to still be an issue the one solution I did find was that you can find your draft directly (even though it would be the last draft) and go through multiple accounts by redirecting to
https://accounts.google.com/AccountChooser?authuser={user account}&Email={email account}&continue=https://mail.google.com/mail/#search/rfc822msgid:CAMU-31NcJCVHyGNsAycRKfuS0nMonoaZ6wFMD90Sej996qjuPQ#mail.gmail.com
You need to get your message id toi replace the area from <> from your draft. So you'll have to create the draft first. Get the google message ID, then use that with messages/get to get the Global Message Id (also referred to as message id) and then use that with a search. At this point you'll open a page with a search to a single draft but it will not be opened. Your users will have to click on the one message. Unfortunately there does not seem to be a way to have the good way work for conversation view, and this way work for non.
I tried many different URLS and nothing worked. As noted in the original question, it might work that you could link to the full URL but I see no way to get that. If you spend long enough working with an email you'll even find that ID changes so they aren't even stable within a single day.
Another solution that could work is as explained:
https://mail.google.com/mail/u/0/#inbox/DRAFT_MESSAGE_ID
But as noted this does not open the draft on the first time you go there. It seems you have to travel to that link 2 times in a row to get the message to appear. I guess you could go to the page maybe inject some javascript to go to the page again but I don't know how to do that.

Setting up simple web application service and testing - Linux debian 10

I am doing my assignment given by the lecturer. On the title stated, my idea is about setting up a mail server on the server and we can send the email from the client, all the email is stored in the server virtual machine. Do my idea is correct on this title stated or any recommendations?
Sending mail is not that hard, especially just using (E)SMTP, tcp
text dialogs. Or you can use Linux mail commands.
Storing mail, either locally or accessing mail on a pop or imap server, poses
another set of challenges.
And of course, you need the HTML web pages as well as the services.
Attaching files can be another challenge, both uploading the files
and encoding them for inclusion in the mail.
JAVAScript can make some usual features of email clients easier, like sorting a list of emails in a folder or from a search by a column ascending or descending.
Searching email is an even bigger challenge!

Download links from email

I am trying to download pdf available in email as hyperlinks. The reason I need this is that I get emails with several such links that needs to be downloaded and saved on a location.
Is there a way this could be automated. Tried checking out ways to do it using python or VBA but no viable solutions so far. This is O365 that I need help on and the hyperlink is embedded in the text highlighted in blue..
You should check the smtp,smtpd modules for a direct interaction with the server.
In the smtp server module you could download the mail locally and extract the info directly and locally, it's useful if you want to keep a backup of your mail, and keep clean your inbox.
In the smtp client module, you could read the email, save it as a object and extract the elements with the mime module, the extract (file) should be translated to a file object and/or saved in de pc as a file with it's extension.
Note: you should look in the internet for the configuration of your mail service to connect in the correct way and the correct sequence of steps, because some servers need a validation of the connection before login and others after the login.

Outlook REST API - getFolders not returning all folders

I'm just getting started with the Outlook REST API. My baseline is the tutorial that uses node-outlook.
First order of business is to retrieve all of the folders in my mail account.
So I issue this REST request:
GET https://outlook.office.com/api/v2.0/Me/MailFolders
Instead of returning all of my folders, it only returns the "well known" folders:
Clutter
Deleted Items
Drafts
Inbox
Junk Email
Outbox
Sent Items
Trash
Am I missing a query parameter or something that says, "no, really, all of them please"?
UPDATE
I tried a different email account, and I also don't get all of my actual folders, but I get a different subset (some of which are well-known, others aren't).
I am implementing the paging protocol (using the #nextLink parameter) so it's not a matter of page sizes. I am getting these 8 folders on one account, and 18 folders on another.
So there must be something that decides what folders will be returned.
UPDATE 2
I changed to doing a folder sync instead using the "beta" API. In this case, I also get an unnamed folder in the list, which is the parent of the other folders. It comes along with a ChildFolderCount which is accurate. However, when I do a child folder request on that folder id I get the same list.
UPDATE 3
Here's the request url I'm using when I attempt to read the child folders of the one folder that comes back with a non-zero ChildFolderCount.
GET https://outlook.office.com/api/beta/Me/MailFolders/AAMkADRmMzFmNjZmLWU3MjctNGZiNi1iZTg4LTRmNGQwYTVhMDgxYgAuAAAAAAB8IxaZ5KGbQom4EPywGCSdAQDVy0eYwAzLS63k5pohzykCAAAAAAEJAAA=/childfolders
Here's what appears to define what folders are returned by this API and what are not:
If I create a folder in office365 directly on outlook webmail, it shows up in this query.
If I create a folder in Mac Mail, it does not.
Mac Mail accesses the service using EWS, so I would expect a folder created by it would be like any other folder.
So there is something about folders created on Mac Mail that prevents them from being returned by this API.
Folders created in Mac Mail DO show up in web mail and vice versa.
Folders created on an iPhone DO show up, so in my limited testing it looks like Mac Mail may be the only app suffering from this problem. The problem I have is most of my folders were created in Mac Mail and I have no easy way of rebuilding them.
I'm thinking this is just a BUG in the API. At any rate, this answers my original question and should help anyone out there trying to use the new API.
If I find a workaround I'll post it here.

Temporary Internet File (read from SharePoint via IE). How do I find the URL?

When an IE user clicks the link of a file residing in SharePoint (and user selects "read-only" access), the file is copied to Temporary Internet Files, my application is opened and passed that filename as a parameter. I'm trying to implement a "check out" button in my app so that a user can switch from read-only mode to check-out and edit mode. I haven't been able to find a way to learn the SharePoint URL for the file. On check-out and edit, it's no problem: there's a registry entry that maps the file on my system to the URL in SharePoint; I haven't found anything like that for read-only files.
EDIT:
There is a URL column available in Windows Explorer, but when I display that column (in Explorer), all the values are blank. Also, I can't find any file information api call that will return this value for me.
UPDATE:
I found some promising calls in the wininet.lib: FindFirstUrlCacheEntryEx (and "next") along with FindFirstUrlCacheGroup (and next). They didn't seem to return any data, and from what I read, these only return my application's use of the wininet api calls cache -- not I.E.'s.
I also tried running through the list of COM calls that IE made into my app when the file was opened to see what interfaces it was seeing if I supported. One that looked promising was the IMonikerProp interface, which, when I implemented it, did get called... however it only provided me with the mime type property, the classid of my app and the TrustedDownload flag.
Maybe this site has the answer: How SharePoint communicates with Word via ActiveX
Another option could be to hook into the SharePoint ItemCheckingOut event. Example 1 Example 2 . In the event you could get the URL info and create some temporary file with the info or pass the info off to your program.
Link to ActiveX control info - Maybe this control is launched on everything? You might be able to tap into that.
Does the temporary file created have a good name (does it match what the file is actually called or is it gibberish). If it's a good name, you can probably search for it. Otherwise, without knowing the site, folder, filename, you might not be able to unless there is some additional data about the file somewhere.

Resources