Download the PHP package eden/mail without Composer

On this page you can find all versions of the php package eden/mail. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mail

logo Eden Mail

Build Status


Install

composer install eden/mail

In order to use


Enable Eden

The following documentation uses eden() in its example reference. Enabling this function requires an extra step as descirbed in this section which is not required if you access this package using the following.

When using composer, there is not an easy way to access functions from packages. As a workaround, adding this constant in your code will allow eden() to be available after.

For example:


Introduction

Eden sports the three common ways to interact with mail servers including SMTP, IMAP and POP3. Accessing each protocol can be acheived like in Figure 1.

Figure 1. Factory

For all three protocols there are four requirements that's needed and all requirements are dependent on your specific email provider. In the figure above we use GMAIL settings as an example. The last argument is a flag. Set it to true if your email provider requires SSL.


IMAP

Eden's IMAP object does uses fsocket() rather than PHP's built in IMAP functions. We chose to use fsocket() instead purely because of performance reasons. You'll find setting up IMAP is overall easier with Eden. Figure 2 shows how to set up the IMAP object.

Figure 2. Setting up the IMAP Object

Very simply, there are four requirements that's needed and all requirements are dependent on your specific email provider. In the figure above we use GMAIL settings as an example. The last argument is a flag. Set it to true if your email provider requires SSL.

Mailboxes

The next thing we want to know are the available mailboxes we can set to active. To get a list of mailboxes follow Figure 3.

Figure 3. Mailbox List

Executing the above command will give you the following results.

Every mail server we looked at has the INBOX folder. So when in doubt, we would say this should be the default active mailbox. Next let's set the INBOX as the active mailbox. Figure 4 shows how we would set and retrieve the active mailbox in one line.

Figure 4. Set Active Mailbox FIRST!

Emails

Now that we have set the active mailbox, we can now continue to get a list of emails. Figure 5 shows how we would go about doing that.

Figure 5. Getting a List of Emails

Executing the above figure would yield you results similar to the snippet below.

Figure 5a. Example Email Results

As you might realize, the email list does not come with the full body nor the attachments. Standard IMAP practices explain you should not try to get a detailed list, because the mere size of the full data could take a long while. The idea for when you should retrieve the full details is when a user specifically call to action to see the body. Figure 6 shows how we would get the details of an email.

Figure 6. Get the Complete Email Details

In the figure above, we call getUniqueEmails() the first argument should be the unique identifier (UID) found in Figure 5a. The second argument is whether if you want the body, leave this true usually. You could get a group of emails comma separated by UIDs in the following manner.

Figure 6a. Get More Than One Email Detail

Including the body and attachments in a list request would definitely take a long time and is not recommended.

Searching

Searching emails follows the basic IMAP format for searching. An example of how to search can be found in Figure 7.

Figure 7. Searching

Search is confined to the emails in the active mailbox. This is an IMAP standard. There is no work around for this.

The combinations of search queries can be referenced below:

ALL - return all messages matching the rest of the criteria
ANSWERED - match messages with the \\ANSWERED flag set
BCC "string" - match messages with "string" in the Bcc: field
BEFORE "date" - match messages with Date: before "date"
BODY "string" - match messages with "string" in the body of the message
CC "string" - match messages with "string" in the Cc: field
DELETED - match deleted messages
FLAGGED - match messages with the \\FLAGGED (sometimes referred to as Important or Urgent) flag set
FROM "string" - match messages with "string" in the From: field
KEYWORD "string" - match messages with "string" as a keyword
NEW - match new messages
OLD - match old messages
ON "date" - match messages with Date: matching "date"
RECENT - match messages with the \\RECENT flag set
SEEN - match messages that have been read (the \\SEEN flag is set)
SINCE "date" - match messages with Date: after "date"
SUBJECT "string" - match messages with "string" in the Subject:
TEXT "string" - match messages with text "string"
TO "string" - match messages with "string" in the To:
UNANSWERED - match messages that have not been answered
UNDELETED - match messages that are not deleted
UNFLAGGED - match messages that are not flagged
UNKEYWORD "string" - match messages that do not have the keyword "string"
UNSEEN - match messages which have not been read yet

Actions

Some other actions you would probably like to perform is moving an email and removing an email. The following figures shows basically the rest of the possible actions you can perform with Eden.

Figure 8. Move Email to Another Folder

Figure 9. Delete Email

Figure 10. Don't Forget to Disconnect!


POP3

Eden's POP3 object does uses fsocket() rather than PHP's built in IMAP functions for POP3. We chose to use fsocket() instead purely because of performance reasons. You'll find setting up POP3 is overall easier with Eden. Figure 11 shows how to set up the POP3 object.

Figure 11. Setting up the POP3 Object

Very simply, there are four requirements that's needed and all requirements are dependent on your specific email provider. In the figure above we use GMAIL settings as an example. The last argument is a flag. Set it to true if your email provider requires SSL.Now that we have set the connection information, we can now continue to get a list of emails. Figure 12 shows how we would go about doing that.

Figure 12. Get Emails

Executing the above figure would return you a list of emails as well as the total count. Some other actions you would probably like to perform is removing an email. The following figures shows basically the rest of the possible actions you can perform with Eden.

Figure 13. Delete Email

Figure 14. Don't Forget to Disconnect!


SMTP

SMTP in Eden is relatively easier. We use fsocket() rather than PHP's built in SMTP functions. We chose to use fsocket() because PHP's mail() function will most likely put your mail in the junk folder. SMTP works better because emails sent is sent by your actual email server versus your web host. Figure 15 shows how to set up the SMTP object.

Figure 15. Setting up the SMTP Object

Very simply, there are four requirements that's needed and all requirements are dependent on your specific email provider. In the figure above we use GMAIL settings as an example. The last argument is a flag. Set it to true if your email provider requires SSL. The next part is simply send your email.

Figure 16. Simply Send

In Figure 16, we basically laid out all the possible combinations of methods you can use to send email. It's important to set the addTo() method at least once.

Figure 17. Don't Forget to Disconnect!


Contributing to Eden

Contributions to Eden are following the Github work flow. Please read up before contributing.

Setting up your machine with the Eden repository and your fork

  1. Fork the repository
  2. Fire up your local terminal create a new branch from the v4 branch of your fork with a branch name describing what your changes are. Possible branch name types:
    • bugfix
    • feature
    • improvement
  3. Make your changes. Always make sure to sign-off (-s) on all commits made (git commit -s -m "Commit message")

Making pull requests

  1. Please ensure to run phpunit before making a pull request.
  2. Push your code to your remote forked version.
  3. Go back to your forked version on GitHub and submit a pull request.
  4. An Eden developer will review your code and merge it in when it has been classified as suitable.

All versions of mail with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.1
eden/core Version 4.*
eden/string Version 4.*
eden/array Version 4.*
eden/path Version 4.*
eden/file Version 4.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package eden/mail contains the following files

Loading the files please wait ....