Giter VIP home page Giter VIP logo

mail's People

Contributors

airondumael avatar bryant1410 avatar cjzamora avatar clark21 avatar cn13 avatar hoosk avatar hubipe avatar klemenp88 avatar kzap avatar leonardoweslei avatar sherlonv avatar soycaringal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mail's Issues

Mark as SEEN

Is it possible to mark message as SEEN via IMAP?

Does not work properly with Yandex Email

I tried simple commands, none of them did not work.
For example I requested for emailBoxes.
the reponse from yandex was :
array(10) { [0]=> string(80) "* LIST (\Unmarked \HasNoChildren \Sent) "|" "&BB4EQgQ,BEAEMAQyBDsENQQ9BD0ESwQ1-"" [1]=> string(66) "* LIST (\Unmarked \HasNoChildren) "|" "&BBgEQQRFBD4ENARPBEkEOAQ1-"" [2]=> string(59) "* LIST (\Unmarked \HasNoChildren \Junk) "|" "&BCEEPwQwBDw-"" [3]=> string(71) "* LIST (\Marked \HasNoChildren \Trash) "|" "&BCMENAQwBDsENQQ9BD0ESwQ1-"" [4]=> string(74) "* LIST (\Unmarked \HasNoChildren \Drafts) "|" "&BCcENQRABD0EPgQyBDgEOgQ4-"" [5]=> string(44) "* LIST (\Unmarked \HasChildren) "|" Archives" [6]=> string(53) "* LIST (\Unmarked \HasNoChildren) "|" "Archives|2017"" [7]=> string(39) "* LIST (\Marked \NoInferiors) "|" INBOX" [8]=> string(47) "* LIST (\Unmarked \HasNoChildren) "|" Templates" [9]=> string(23) "TAG2 OK LIST Completed." }

but the result of $imap->getEmailTotal() was:
Array ( [0] => ???????????? [1] => ????????? [2] => ???? [3] => ????????? [4] => ????????? [5] => | [6] => Archives|2017 [7] => | [8] => | )

Illegal string offset 'messages'

Is this some bug? Or you're missing something?
screenshot_1
Last time i checked, i dont thing u need to put "$total = $total['messages'];" on there anymore, cause you have return some number on getEmailTotal function.
screenshot_4
Sorry for my bad English, btw i like your project..

getEmails() should not set 'seen' flag on messages that are unread

When getEmails() is called, it will set seen flag on every message that is fetched. This makes it difficult to mark messages as "unread" in the fetched list. Ideally, when messages(list, not full message body) are fetched, this behavior should be avoided. To fix this, I replaced code in line 313 of Imap.php (I haven't used POP3 yet, you can imitate this behavior there, if needed):
Replace:
$items = array('UID', 'FLAGS', 'BODY[HEADER]'); // Line 313
with
$items = array('UID', 'FLAGS', 'BODY.PEEK[HEADER]');
and the problem will be fixed. Cheers!

(Mail) Pop3: Remove Message

If i try to remove a message, what number (uid) i have to provide?

If i do getEmails( 1, 1 ) it should return $Message #1 right?

  • So remove( 1 ) has to (at least) mark it as deleted

= won't work

  • So i switched to $Message['Id']: remove( '<some strange id here>' )

= won't work

Am I doing it wrong, or is something broken?

PS: There is no field $Message['Uid'] as in imap message

isUtf8 function is wrong

When a character is sent (á, é, í, ú, ó, ñ...), the function returns false and messes up on some email clients (sets the charset to US-ASCII). Maybe switch the returns will fix this?

SMTP problem attachment

Hi,

I have a problem when I try to send an attachment..

My code :

$nameImage = "file.jpg";
$pathToFile = "../../Data/Image/file.jpg";
$typeMime = mime_content_type($pathToFile);

$smtp = eden('mail')->smtp(_SMTP,_USER_EMAIL,_USER_PASSWORD,465,true);
$smtp->setSubject("Subject")
  ->setBody($MessageDecode,true)
  ->addTo($Email)
  ->addAttachment($nameImage , $pathToFile, $typeMime)        
  ->send(array("From"=>"Me"));
$smtp->disconnect();

When I receive the e-mail, the attachment is invalid :/
An idea ? A solution ?

Thx :)

Notice: Undefined variable: code in vendor\eden\core\src\Argument.php on line 54

Hello,

After I installed the latest version via composer and run
$database = eden('mysql', '[HOST]' ,'[DBNAME]', '[USER]', '[PASS]'); //instantiate
I get a msg:
Fatal error: Call to undefined function eden() in /index.php on line
I search this error on google and see this issues Eden-PHP/Mysql#1
I add Eden::DECORATOR; after require autoload

require_once __DIR__.'/vendor/autoload.php'; Eden::DECORATOR;
And I get a new php error:

Notice: Undefined variable: message in D:\HomeServer\htdocs\phpdemo\mail\vendor\eden\core\src\Argument.php on line 54

Notice: Undefined variable: code in D:\HomeServer\htdocs\phpdemo\mail\vendor\eden\core\src\Argument.php on line 54

Please help me, thanks!

$headers2['content-type'] is not string

Warning: mb_strpos() expects parameter 1 to be string, array given in vendor/eden/mail/src/Imap.php on line 988

$attachment = isset($headers2['content-type'])
        && strpos($headers2['content-type'], 'multipart/mixed') === 0;

Extracting Attachments

How to extract attachment, saving, or download ?

result is just strings:

$email = $imap->getUniqueEmails(299, true); 
echo $email['attachment']['presentasi hasil.pptx'];

do I have to create my own header attachment to be able to download it directly?

Undefined offset -1 in Imap.php

I get an "undefined offset" notice when the if statement within foreach is true, when nothing has yet been assigned to $head.

Undefined offset: -1
file: /Users/admin/Coding/pgm-impexp/vendor/eden/mail/src/Imap.php
line: 898

    $lines = explode("\n", $head);
    $head = array();
    foreach ($lines as $line) {
        if (trim($line) && preg_match("/^\s+/", $line)) {
            $head[count($head)-1] .= ' '.trim($line);
            continue;
        }

        $head[] = trim($line);
    }

Perhaps the if condition can be updated like this:

    if (count($head) > 0 && trim($line) && preg_match("/^\s+/", $line)) {

How to use Proxy

Thank you for your contribution! I want to use Proxy, but I'm not found any method! Thank You

Undefined variable: message

I am using in Laravel 5.4 and I am getting the following error:

Undefined variable: message
in Argument.php (line 55).

One of the solution I found it to remove arguments from function i():
like
return new $class($message, $code); -> return new $class();

But then it is giving me error:
Call to undefined method Illuminate\Support\Facades\Mail::imap() ...

will someone kindly help me

Error: Fatal error: Uncaught Eden\Core\Exception

Hello,

Using Eden like this:

Eden::DECORATOR;

$imap = eden('mail')->imap(
    'imap.gmail.com',
    '[email protected]',
    'xxxx',
    993,
    true);
$mailboxes = $imap->getMailboxes();
$imap->setMailboxes('INBOX')->getActiveInbox();
$emails = $imap->getEmails(0, 3);
$count = $imap->getEmailTotal();
echo '<pre>';
print_r($emails);
echo '</pre>';
$imap->disconnect();

And getting error:

Fatal error: Uncaught Eden\Core\Exception: Both Physical and Virtual method Eden\Mail\Imap->setMailboxes() does not exist.

[BUG] Undefined Variables

Notice: Undefined variable: message in ../vendor/eden/core/src/Argument.php on line 54

PHP Notice: Undefined variable: code in ../vendor/eden/core/src/Argument.php on line 54

getParts() fails in some cases

The function getParts() of src/Pop3.php fails when some header information is not written in lowercase, like Boundary=... instead of boundary=....

Solution is to replace

$extra[$key] = $value;

with

$extra[strtolower($key)] = $value;

//foreach extra
foreach ($extra as $i => $attr) {
    //transform the extra array to a key value pair
    $attr = explode('=', $attr, 2);
    if (count($attr) > 1) {
        list($key, $value) = $attr;
        $extra[strtolower($key)] = $value;
    }
    unset($extra[$i]);
}

Undefined variable: message in Argument.php line 54

use case

When setting up a new Imap class like so:

$imap = new Eden('imap.gmail.com', '[email protected]', 'x-my-very-secret-password', '993', true);

and trying to fetch the mailboxes like so $imap->getMailboxes()
I get the following error message:

PHP error:  Undefined variable: message in (..laravel..)/vendor/eden/core/src/Argument.php on line 54

It seems to involve the following snippet

    /**
     * One of the hard thing about instantiating classes is
     * that design patterns can impose different ways of
     * instantiating a class. The word "new" is not flexible.
     * Authors of classes should be able to control how a class
     * is instantiated, while leaving others using the class
     * oblivious to it. All in all its one less thing to remember
     * for each class call. By default we instantiate classes with
     * this method.
     *
     * @param mixed[,mixed..] $args Arguments to pass to the constructor
     *
     * @return Eden\Core\Argument
     */
    public static function i()
    {
        $class = __CLASS__;
        return new $class($message, $code); // <-- this line
    }

I haven't found the solution yet, but it seems that $message is never set.

Moving gets Exception when removing after copying to another inbox

In method:

public function remove($uid)

the parameter expected must be an integer or string. However, when a move procedure is called in

public function move($uid, $mailbox)

the $uid is an integer or string as well, but the line 374 to 376

if (!is_array($uid)) {
   $uid = array($uid);
}

forces an array type in it to be used in implode(). And in line 380 it calls the remove($uid) without transforming it back to integer or string, causing an exception:

PHP Fatal error:  Uncaught exception 'Eden\Core\Exception' with message 'Argument 1 in Eden\Mail\Imap->remove() was expecting int or string, however Array was given.' in /var/www/Apps/Integrata/Sync/vendor/eden/core/Eden/Core/Exception.php:61

Active Mailbox docs

It's setActiveMailbox on imap. Had to look into the files for that.
And maybe also quite interesting. If you search for mails and you would like to get the body, too, set body true.
Anyway, very nice lib, but doc needs more work :D

Attachments not recognized

In some circumstances attachments are not recognized in getParts() of src/Pop3.php.

Look at this header part for example:

Content-Type: application/pdf
Content-Length: 71203
Content-Disposition: attachment; filename="RG150289993335.pdf"
Content-Transfer-Encoding: base64

Normally Eden would expect the filename to be part of the the Content-Type line:

Content-Type: application/pdf; name="RG150289993335.pdf"

If not, Eden fails to recognize it as an attachment.

My (possibly dirty) fix is to add after

$extra = array();
if (count($type) == 2) {
    $extra = explode('; ', str_replace(array('"', "'"), '', trim($type[1])));
}

the following line:

if (isset($head['content-disposition'])) {
    $extra = array_merge($extra, explode('; ', str_replace(array('"', "'"), '', $head['content-disposition'])));
}

And then after

foreach ($extra as $i => $attr) {
    //transform the extra array to a key value pair
    $attr = explode('=', $attr, 2);
    if (count($attr) > 1) {
        list($key, $value) = $attr;
        $extra[strtolower($key)] = $value;
    }
    unset($extra[$i]);
}

this line:

if (isset($extra['filename'])) {
    if (!isset($extra['name'])) {
        $extra['name'] = $extra['filename'];
    }
    unset($extra['filename']);
}

eden not a function

For me, whenever I try to connect or run the eden function. PHP says that eden is not defined or is not a function. Why is this happening, I followed the instructions. I included the autoload.php file from vendor.

Undefined variable $message

Hi, getting the following error with trace:

Undefined variable $message
 

... vendor/eden/core/src/Argument.php:54
vendor/eden/core/src/Route.php:119
vendor/eden/core/src/Base.php:598
vendor/eden/core/src/Base.php:72
vendor/eden/core/src/Control.php:20

Using code

 $this->pop = eden('mail')->pop3(MAIL_SERVER,
            USERNAME,
           PASSWORD);

Undefined offset: 2

When downloading certain emails "in vendor/eden/mail/src/Imap.php at line 1371".
Here's what imap pushes to Eden
array('header' => '', 'headers' => object(stdClass), 'tos' => array(), 'ccs' => array(), 'bccs' => array(), 'ID' => array())
Annoying since i cannot download whole mailbox that contains less than 90 mails.

Office 365 POP3 response is empty and count is 0

I configured with office 365 POP3 settings. Connection is successful but when try to use getEmailTotal, it's always returning 0 and getEmails response is also empty. checked with some others like ionos etc, working fine for them

How to use Mail?

$ composer install eden/mail
Invalid argument eden/mail. Use "composer require eden/mail" instead to add packages to your composer.json.

$imap = eden('mail')->imap(
'imap.gmail.com',
'[email protected]',
'[YOUR PASSWORD]',
993,
true);

eden is function? I can't find eden source.

And which file should I include?

Class Mail does not exist

When I tried to get maillist from gmail it returns followings. Where Can I get Mail Class?
Fatal error: Uncaught exception 'Eden\Core\Exception' with message 'Class Mail does not exist' in /home/user/www/vendor/eden/core/src/Control.php:26
Stack trace:
#0 /home/user/www/vendor/eden/core/src/Base.php(246): Eden\Core\Exception::i('Class Mail does...')
#1 /home/user/www/vendor/eden/core/src/Control.php(26): Eden\Core\Base->__invoke(Array)
#2 /home/user/www/classes/MailReader.php(65): eden('mail')
#3 /home/user/www/classes/MailReader.php(112): MailReader->read_email()
#4 /home/user/www/scripts/mail-parser.php(24): MailReader->process()
#5 {main}
thrown in /home/user/www/vendor/eden/core/src/Control.php on line 26

no way to delete messages

i cant delete messages. i have to switch off this library -
it's too bad because i prefer this over the alternatives.

Missing 8bit

In getParts() of src/Pop3.php there is a case missing for 8 bit content transfer encoding:

8bit is already UTF-8 (as I know, but I am not 100 % sure), so not more than extending the switch is necessary:

switch (strtolower($head['content-transfer-encoding'])) {
    case 'binary':
        $body = imap_binary($body);
        break;
    case 'base64':
        $body = base64_decode($body);
        break;
    case 'quoted-printable':
        $body = quoted_printable_decode($body);
        break;
    case '7bit':
        $body = mb_convert_encoding($body, 'UTF-8', 'ISO-2022-JP');
        break;
    case '8bit':
        break;
    default:
        $body = str_replace(array("\n", ' '), '', $body);
        break;
}

Encoding of body

Content-Type can contains field "charset". I think that it would be logical way to convert it to utf8, because returned message from function does not contains information about extra fields.

$parts[$type] = isset($extra['charset']) ? mb_convert_encoding($body, 'UTF-8', $extra['charset']) : $body;

tiny fix

composer install should be composer require in your readme.md.

get empty mailboxes

bug work in imap.mastermail.ru
I modifed this method:
/**
* Returns a list of mailboxes
*
* @return array
*/
public function getMailboxes()
{
if (!$this->socket) {
$this->connect();
}

    $response = $this->call('LIST', $this->escape('', '*'));

    $mailboxes = array();
    foreach ($response as $line) {

        if (strpos($line, 'Noselect') !== false || strpos($line, 'LIST') == false) {
            continue;
        }

        //* LIST (\HasNoChildren) "/" &BBQEPQQ1BDIEPQQ4BDo-
        if(!preg_match("~(\*\sLIST\s\(.*?\))\s\"(.)\"\s(.*)~is", $line, $match)){
            continue;
        }

        $name = trim($match[3],'"');

        $m2 = explode("{$match[2]}", $name );

        $mailboxes[$name] = [
            'name'      =>  $m2[count($m2)-1],
            "parent"    =>  $m2[count($m2)-2]
        ];
    }

    return $mailboxes;
}

eden is undefined?

require 'vendor/autoload.php';

$imap = eden('mail')->imap(
'server179.web-hosting.com',
'[email protected]',
'lawyer12345?',
993,
true);

$mailboxes = $imap->getMailboxes(); 
print_r( $mailboxes );

Use of PHP IMAP extension without corresponding composer requirement

When e-mail part is encoded as binary, the function imap_binary() is called. But imap_binary() is part of PHP IMAP extension and thus should be required in composer neon. If the extension is not loaded, then Fatal Error Call to undefined funcion Eden\Mail\imap_binary() is thrown.

function getMailboxes() returns all .'s as listed inboxes - corrected code

public function getMailboxes()
{
    if (!$this->socket) {
        $this->connect();
    }

    $response = $this->call('LIST', $this->escape('', '*'));

    $mailboxes = array();
    foreach ($response as $line) {
        if (strpos($line, 'Noselect') !== false || strpos($line, 'LIST') == false) {
            continue;
        }
        
        $line = explode('"."', $line);
        if (strpos(trim($line[0]), '*') !== 0) {
            continue;
        }

        $mailboxes[] = $line[1];
    }

    return $mailboxes;
}

The above code resolves the issue with the getMailboxes returning only '.' as the list of mailboxes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.