Giter Club home page Giter Club logo

mail's Introduction

Mail

Class that provides multiple interfaces for sending emails.

PEAR's Mail package defines an interface for implementing mailers under the PEAR hierarchy. It also provides supporting functions useful to multiple mailer backends.

Currently supported backends include:

  • PHP's native mail() function
  • sendmail
  • SMTP

This package also provides a RFC 822 email address list validation utility class.

Use Mail in combination with Mail_Mime to send HTML emails or emails with attachments - have a look at the example.

Installation

PEAR

$ pear install mail

Composer

$ composer require pear/mail

Links

Homepage
http://pear.php.net/package/Mail
Source code
https://github.com/pear/Mail
Issue tracker
http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Mail
Unit test status
https://travis-ci.org/pear/Mail
Packagist
https://packagist.org/packages/pear/mail

mail's People

Contributors

alecpl avatar ammarpad avatar ashnazg avatar athos-ribeiro avatar clockwerx avatar cweiske avatar exussum12 avatar fiftin avatar gauthierm avatar glensc avatar jparise avatar kenguest avatar matidau avatar mj avatar peterthomassen avatar reedy avatar richardbrinkman avatar roelvanmeer avatar schengawegga avatar stigsb avatar till avatar tvvcox 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

Watchers

 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

Calling get_class() without arguments is deprecated

Hello,

I'm presuming that this is the proper place to report bugs for PEAR's Mail:: interface.

Before anything else I'd really like to mention that it would be very nice to have the version of the software in the core directory files, no idea why it isn't (not talking about which versions of PHP are supported).

I updated to PHP 8.3 about two months ago and encountered a non-related error, fixed it and have since (before this new bug) been able to send email from my previous server for basic notifications (e.g. someone contacted the website through the contact form).

Then I had to do a server migration so there is a new environment however I'm still using PHP 8.3 on the new server. None of my code changed. I suspect an issue with cPanel's WHM (they really like changing things on a whim to the extent they make the Joker look like an agent of order) though I'm not sure where to look (they use stuff like Exim).

A member on the host's tech team mentioned the exim_mainlog file and every time I attempt to use the contact form all connections to the server hang for several minutes.

2024-07-02 02:14:02 TLS error on connection from [181.224.129.250]:51306 (SSL_accept): timed out.

I tested both a local server email address and remote one (have had a third even earlier non-related issue with cPanel) without any difference.

I don't write PHP in this...style so I'm not really reading well in to what is going on. I'm happy to make any clarifications I can.

Array
(
    [0] => Array
        (
            [file] => /[__SERVER__PATH__]/php/PEAR.php
            [line] => 235
            [function] => error_handle
            [args] => Array
                (
                    [0] => 8192
                    [1] => Calling get_class() without arguments is deprecated
                    [2] => /[__SERVER__PATH__]/php/PEAR.php
                    [3] => 235
                )

        )

    [1] => Array
        (
            [file] => /[__SERVER__PATH__]/php/Net/SMTP.php
            [line] => 368
            [function] => __callStatic
            [class] => PEAR
            [type] => ::
            [args] => Array
                (
                    [0] => raiseError
                    [1] => Array
                        (
                            [0] => Invalid response code received from server
                            [1] => 451
                        )

                )

        )

    [2] => Array
        (
            [file] => /[__SERVER__PATH__]/php/Net/SMTP.php
            [line] => 971
            [function] => parseResponse
            [class] => Net_SMTP
            [object] => Net_SMTP Object
                (
                    [host] => mail.jabcreations.com
                    [port] => 465
                    [localhost] => localhost
                    [auth_methods] => Array
                        (
                            [DIGEST-MD5] => Array
                                (
                                    [0] => Net_SMTP Object
 *RECURSION*
                                    [1] => authDigestMD5
                                )

                            [CRAM-MD5] => Array
                                (
                                    [0] => Net_SMTP Object
 *RECURSION*
                                    [1] => authCramMD5
                                )

                            [LOGIN] => Array
                                (
                                    [0] => Net_SMTP Object
 *RECURSION*
                                    [1] => authLogin
                                )

                            [PLAIN] => Array
                                (
                                    [0] => Net_SMTP Object
 *RECURSION*
                                    [1] => authPlain
                                )

                        )

                    [pipelining] => 
                    [pipelined_commands:protected] => 0
                    [debug:protected] => 
                    [debug_handler:protected] => 
                    [socket:protected] => Net_Socket Object
                        (
                            [_debug] => 
                            [_default_error_mode] => 
                            [_default_error_options] => 
                            [_default_error_handler] => 
                            [_error_class] => PEAR_Error
                            [_expected_errors] => Array
                                (
                                )

                            [fp] => Resource id #54
                            [blocking] => 1
                            [persistent] => 
                            [addr] => mail.jabcreations.com
                            [port] => 465
                            [timeout] => 
                            [lineLength] => 2048
                            [newline] => 

                        )

                    [socket_options:protected] => Array
                        (
                        )

                    [timeout:protected] => 0
                    [code:protected] => 451
                    [arguments:protected] => Array
                        (
                            [0] => Temporary local problem - please try later
                        )

                    [greeting:protected] => server.jabcreations.com ESMTP Exim 4.97.1 #2 Sun, 30 Jun 2024 04:46:03 -0700
We do not authorize the use of this system to transport unsolicited,
and/or bulk e-mail.
                    [esmtp:protected] => Array
                        (
                            [server.jabcreations.com] => Hello localhost [181.224.129.250]
                            [SIZE] => 52428800
                            [8BITMIME] => 
                            [PIPELINING] => 
                            [PIPECONNECT] => 
                            [AUTH] => PLAIN LOGIN
                            [STARTTLS] => 
                            [HELP] => 
                        )

                )

            [type] => ->
            [args] => Array
                (
                    [0] => Array
                        (
                            [0] => 250
                            [1] => 251
                        )

                    [1] => 
                )

        )

    [3] => Array
        (
            [file] => /[__SERVER__PATH__]/php/Mail/smtp.php
            [line] => 382
            [function] => rcptTo
            [class] => Net_SMTP
            [object] => Net_SMTP Object
                (
                    [host] => mail.jabcreations.com
                    [port] => 465
                    [localhost] => localhost
                    [auth_methods] => Array
                        (
                            [DIGEST-MD5] => Array
                                (
                                    [0] => Net_SMTP Object
 *RECURSION*
                                    [1] => authDigestMD5
                                )

                            [CRAM-MD5] => Array
                                (
                                    [0] => Net_SMTP Object
 *RECURSION*
                                    [1] => authCramMD5
                                )

                            [LOGIN] => Array
                                (
                                    [0] => Net_SMTP Object
 *RECURSION*
                                    [1] => authLogin
                                )

                            [PLAIN] => Array
                                (
                                    [0] => Net_SMTP Object
 *RECURSION*
                                    [1] => authPlain
                                )

                        )

                    [pipelining] => 
                    [pipelined_commands:protected] => 0
                    [debug:protected] => 
                    [debug_handler:protected] => 
                    [socket:protected] => Net_Socket Object
                        (
                            [_debug] => 
                            [_default_error_mode] => 
                            [_default_error_options] => 
                            [_default_error_handler] => 
                            [_error_class] => PEAR_Error
                            [_expected_errors] => Array
                                (
                                )

                            [fp] => Resource id #54
                            [blocking] => 1
                            [persistent] => 
                            [addr] => mail.jabcreations.com
                            [port] => 465
                            [timeout] => 
                            [lineLength] => 2048
                            [newline] => 

                        )

                    [socket_options:protected] => Array
                        (
                        )

                    [timeout:protected] => 0
                    [code:protected] => 451
                    [arguments:protected] => Array
                        (
                            [0] => Temporary local problem - please try later
                        )

                    [greeting:protected] => server.jabcreations.com ESMTP Exim 4.97.1 #2 Sun, 30 Jun 2024 04:46:03 -0700
We do not authorize the use of this system to transport unsolicited,
and/or bulk e-mail.
                    [esmtp:protected] => Array
                        (
                            [server.jabcreations.com] => Hello localhost [181.224.129.250]
                            [SIZE] => 52428800
                            [8BITMIME] => 
                            [PIPELINING] => 
                            [PIPECONNECT] => 
                            [AUTH] => PLAIN LOGIN
                            [STARTTLS] => 
                            [HELP] => 
                        )

                )

            [type] => ->
            [args] => Array
                (
                    [0] => [valid outgoing email address]
                )

        )

    [4] => Array
        (
            [file] => /[__SERVER__PATH__]/php/Mail/smtp.php
            [line] => 319
            [function] => send_or_fail
            [class] => Mail_smtp
            [object] => Mail_smtp Object
                (
                    [sep] => 

                    [_smtp] => Net_SMTP Object
                        (
                            [host] => mail.jabcreations.com
                            [port] => 465
                            [localhost] => localhost
                            [auth_methods] => Array
                                (
                                    [DIGEST-MD5] => Array
                                        (
                                            [0] => Net_SMTP Object
 *RECURSION*
                                            [1] => authDigestMD5
                                        )

                                    [CRAM-MD5] => Array
                                        (
                                            [0] => Net_SMTP Object
 *RECURSION*
                                            [1] => authCramMD5
                                        )

                                    [LOGIN] => Array
                                        (
                                            [0] => Net_SMTP Object
 *RECURSION*
                                            [1] => authLogin
                                        )

                                    [PLAIN] => Array
                                        (
                                            [0] => Net_SMTP Object
 *RECURSION*
                                            [1] => authPlain
                                        )

                                )

                            [pipelining] => 
                            [pipelined_commands:protected] => 0
                            [debug:protected] => 
                            [debug_handler:protected] => 
                            [socket:protected] => Net_Socket Object
                                (
                                    [_debug] => 
                                    [_default_error_mode] => 
                                    [_default_error_options] => 
                                    [_default_error_handler] => 
                                    [_error_class] => PEAR_Error
                                    [_expected_errors] => Array
                                        (
                                        )

                                    [fp] => Resource id #54
                                    [blocking] => 1
                                    [persistent] => 
                                    [addr] => mail.jabcreations.com
                                    [port] => 465
                                    [timeout] => 
                                    [lineLength] => 2048
                                    [newline] => 

                                )

                            [socket_options:protected] => Array
                                (
                                )

                            [timeout:protected] => 0
                            [code:protected] => 451
                            [arguments:protected] => Array
                                (
                                    [0] => Temporary local problem - please try later
                                )

                            [greeting:protected] => server.jabcreations.com ESMTP Exim 4.97.1 #2 Sun, 30 Jun 2024 04:46:03 -0700
We do not authorize the use of this system to transport unsolicited,
and/or bulk e-mail.
                            [esmtp:protected] => Array
                                (
                                    [server.jabcreations.com] => Hello localhost [181.224.129.250]
                                    [SIZE] => 52428800
                                    [8BITMIME] => 
                                    [PIPELINING] => 
                                    [PIPECONNECT] => 
                                    [AUTH] => PLAIN LOGIN
                                    [STARTTLS] => 
                                    [HELP] => 
                                )

                        )

                    [_extparams] => Array
                        (
                        )

                    [host] => mail.jabcreations.com
                    [port] => 465
                    [starttls] => 
                    [auth] => 1
                    [username] => [valid noreply outgoing email address]
                    [password] => -----------------------------
                    [localhost] => localhost
                    [timeout] => 
                    [debug] => 
                    [debug_handler] => 
                    [greeting] => 
                    [persist] => 
                    [pipelining] => 
                    [socket_options] => Array
                        (
                        )

                    [response] => 
                    [queued_as] => 
                )

            [type] => ->
            [args] => Array
                (
                    [0] => Array
                        (
                            [0] => [valid outgoing email address]
                        )

                    [1] => Array
                        (
                            [MIME-Version] => 1.0
                            [Date] => Sun, 30 Jun 2024 11:46:03 +0000
                            [From] => JAB Creations Notifications <[valid noreply outgoing email address]>
                            [Message-Id] => <[email protected]>
                            [Subject] => JAB Creations - Verification Code: 540
                            [To] => [valid outgoing email address]
                            [Content-Type] => multipart/alternative;
 boundary="=_cb9691c5802849b0715cd3e798ad730c"
                        )

                    [2] => --=_cb9691c5802849b0715cd3e798ad730c
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1

[removed]
----------------------------------------

This email was automatically generated, please do not reply as this address=
 does not process incoming email.
--=_cb9691c5802849b0715cd3e798ad730c
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

[removed]
--=_cb9691c5802849b0715cd3e798ad730c--

                )

        )

    [5] => Array
        (
            [file] => /[__SERVER__PATH__]/[my centralized PHP function that calls Pear Mail ].php
            [line] => 146
            [function] => send
            [class] => Mail_smtp
            [object] => Mail_smtp Object
                (
                    [sep] => 

                    [_smtp] => Net_SMTP Object
                        (
                            [host] => mail.jabcreations.com
                            [port] => 465
                            [localhost] => localhost
                            [auth_methods] => Array
                                (
                                    [DIGEST-MD5] => Array
                                        (
                                            [0] => Net_SMTP Object
 *RECURSION*
                                            [1] => authDigestMD5
                                        )

                                    [CRAM-MD5] => Array
                                        (
                                            [0] => Net_SMTP Object
 *RECURSION*
                                            [1] => authCramMD5
                                        )

                                    [LOGIN] => Array
                                        (
                                            [0] => Net_SMTP Object
 *RECURSION*
                                            [1] => authLogin
                                        )

                                    [PLAIN] => Array
                                        (
                                            [0] => Net_SMTP Object
 *RECURSION*
                                            [1] => authPlain
                                        )

                                )

                            [pipelining] => 
                            [pipelined_commands:protected] => 0
                            [debug:protected] => 
                            [debug_handler:protected] => 
                            [socket:protected] => Net_Socket Object
                                (
                                    [_debug] => 
                                    [_default_error_mode] => 
                                    [_default_error_options] => 
                                    [_default_error_handler] => 
                                    [_error_class] => PEAR_Error
                                    [_expected_errors] => Array
                                        (
                                        )

                                    [fp] => Resource id #54
                                    [blocking] => 1
                                    [persistent] => 
                                    [addr] => mail.jabcreations.com
                                    [port] => 465
                                    [timeout] => 
                                    [lineLength] => 2048
                                    [newline] => 

                                )

                            [socket_options:protected] => Array
                                (
                                )

                            [timeout:protected] => 0
                            [code:protected] => 451
                            [arguments:protected] => Array
                                (
                                    [0] => Temporary local problem - please try later
                                )

                            [greeting:protected] => server.jabcreations.com ESMTP Exim 4.97.1 #2 Sun, 30 Jun 2024 04:46:03 -0700
We do not authorize the use of this system to transport unsolicited,
and/or bulk e-mail.
                            [esmtp:protected] => Array
                                (
                                    [server.jabcreations.com] => Hello localhost [181.224.129.250]
                                    [SIZE] => 52428800
                                    [8BITMIME] => 
                                    [PIPELINING] => 
                                    [PIPECONNECT] => 
                                    [AUTH] => PLAIN LOGIN
                                    [STARTTLS] => 
                                    [HELP] => 
                                )

                        )

                    [_extparams] => Array
                        (
                        )

                    [host] => mail.jabcreations.com
                    [port] => 465
                    [starttls] => 
                    [auth] => 1
                    [username] => [valid noreply outgoing email address]
                    [password] => -----------------------------
                    [localhost] => localhost
                    [timeout] => 
                    [debug] => 
                    [debug_handler] => 
                    [greeting] => 
                    [persist] => 
                    [pipelining] => 
                    [socket_options] => Array
                        (
                        )

                    [response] => 
                    [queued_as] => 
                )

            [type] => ->
            [args] => Array
                (
                    [0] => [valid outgoing email address]
                    [1] => Array
                        (
                            [MIME-Version] => 1.0
                            [Date] => Sun, 30 Jun 2024 11:46:03 +0000
                            [From] => JAB Creations Notifications <[valid noreply outgoing email address]>
                            [Message-Id] => <[email protected]>
                            [Subject] => JAB Creations - Verification Code: 540
                            [To] => [valid outgoing email address]
                            [Content-Type] => multipart/alternative;
 boundary="=_cb9691c5802849b0715cd3e798ad730c"
                        )

                    [2] => --=_cb9691c5802849b0715cd3e798ad730c
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1

[removed]
----------------------------------------

This email was automatically generated, please do not reply as this address=
 does not process incoming email.
--=_cb9691c5802849b0715cd3e798ad730c
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

[removed]
--=_cb9691c5802849b0715cd3e798ad730c--

                )

        )

SCRAM-SHA-1(-PLUS) + SCRAM-SHA-256(-PLUS) + SCRAM-SHA-512(-PLUS) + SCRAM-SHA3-512(-PLUS) supports

Dear @pear team,

Can you add supports of :

  • SCRAM-SHA-1
  • SCRAM-SHA-1-PLUS
  • SCRAM-SHA-256
  • SCRAM-SHA-256-PLUS
  • SCRAM-SHA-512
  • SCRAM-SHA-512-PLUS
  • SCRAM-SHA3-512
  • SCRAM-SHA3-512-PLUS

You can add too:

  • SCRAM-SHA-224
  • SCRAM-SHA-224-PLUS
  • SCRAM-SHA-384
  • SCRAM-SHA-384-PLUS

A "big" list has been done in last link of this ticket.


SCRAM-SHA-1(-PLUS):

SCRAM-SHA-256(-PLUS):

SCRAM-SHA-512(-PLUS):

SCRAM-SHA3-512(-PLUS):

SCRAM BIS: Salted Challenge Response Authentication Mechanism (SCRAM) SASL and GSS-API Mechanisms:

-PLUS variants:

IMAP:

LDAP:

  • RFC5803: Lightweight Directory Access Protocol (LDAP) Schema for Storing Salted: Challenge Response Authentication Mechanism (SCRAM) Secrets: https://tools.ietf.org/html/rfc5803

HTTP:

JMAP:

2FA:

IANA:

Linked to:

setDebug does not expose handler

Backward-compatible change in smtp.php, line 411:

if (is_callable($this->debug)) {
$this->_smtp->setDebug(true, $this->debug);
} else {
$this->_smtp->setDebug(true);
}

queued does not work for gmail

Gmail, among others, doesn't use 'queued as'

Line 363, smtp.php

if (preg_match("/ queued as (.*)/", $args, $queued)) {

should be

if (preg_match("/.* ([a-z0-9_-]+)$/i", $args, $queued)) {

Wrong header separator

mail() documentation says:

additional_headers (optional) [...] Multiple extra headers should be separated with a CRLF (\r\n)

However, Mail_mail sets the header separator to PHP_EOL (if that constant is defined). On my system, this is \n (in contrast to what mail() expects).

As a result, on my system (Ubuntu 22.04, PHP 8.1), additional headers are not properly delivered: All but the first header are indented with a single space, making them a continuation of the previous header. Example message (as actually delivered):

To: recipient@local
Subject: Test subject
MIME-Version: 1.0
 Bcc: secret.recipient@local
 Sender: sender@local
 From: First Last <from@local>
 Content-Type: multipart/mixed;
 boundary="=_0a0ac24becceaae619c86104faa042c3"
Message-Id: <[email protected]>

This results in fully broken email display (MIME boundary does not work, Bcc header malformed and thus retained as plaintext, ...). -- Note that the first header (MIME-Version) does not have the space.

I cannot tell at which point (after calling mail()) these spaces get inserted. But I can tell that Mail_mail's practice of using PHP_EOL (\n) as a separator when passing additional_headers to mail() is in contradiction to the docs, which say that \r\n should be used.

And indeed when I override ->sep = "\r\n" on my Mail_mail instance, the problem goes away.

As things work as described in the mail() documentation, I think that the logic for setting sep is flawed, and \r\n should be used exclusively.

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.