You may want to include
https://github.com/horde/Mime/blob/master/lib/Horde/Mime/Mail.php with
it, or get me write access to the document.
Zitat von Hari K T <[email protected]>:
There was some initiatives made to get the common method names .
Sharing the spreadsheet . I did one myself
( https://docs.google.com/spreadsheets/d/1Lh-g2AoT-4ivMPkGv8S_0JLVCZg9q5zk8yC2L6Ql4N4/edit#gid=0 ) , but the one below was copied from someone else ( Don't recall, may be Michael Cullum ?
)
https://docs.google.com/spreadsheets/d/1Q5vQMLutP1JQq4q8apt-pTNMBfJYqjVQ2GfqxRAWcHM/edit#gid=0
/HARI K T/
You can ring me : +91 9388 75 8821
http://harikt.com , https://github.com/harikt ,
http://www.linkedin.com/in/harikt ,
http://www.xing.com/profile/Hari_KT
Skype : kthari85
Twitter : harikt
On Thu, Aug 2, 2018 at 11:01 AM, <[email protected]> wrote:
While developing the contact pages for some of my websites, I
recently thought about this. About how having a wrapper class or
standard interfaces would allow me to easily switch between mailer
libraries. Having a standard allows easy switching. I ended up with
something like this:
MAILER INTERFACE:
compose(EmailInterface $email): MessageInterface;
withHost(string $host);
withPort(int $port);
withProtocol(string $protocol);
withAuth(string $username, string $password);
withDkim(
string $domain,
string $selector = 'default',
?string $identity = null, ?string
$passphrase = null,
?string $privateKeyFilePath = null,
?string $privateString = null
);
/**
* Send one email message to a single 'to' recipient.
*
* If email has multiple recipients (as specified in 'to' field),
* the method delegates the request to $this::sendBatch() if the
* message body is not a callable, otherwise the request is
* delegated to $this::sendMultiple() instead.
*/
send();
EMAILINTERFACE:
setTo(string|array $to);
setFrom(string $from);
setReplyTo(string|array $replyTo);
setCc(string|array $cc);
setBcc(string|array $bcc);
setMainRecipient(string $mainRecipient);
getMainRecipient(): string;
getTo();
getFrom(): string;
getReplyTo();
getCc();
getBcc();
getMessage(): MessageInterface;
MESSAGEINTERFACE:
write(string|callable $body);
setSubject(string $subject);
setAltBody(string $altBody);
setCharset(string $charset);
withAttachment(string $file, string $contentType = '');
clearAttachments();
getSubject(): string;
getBody(): string|callable;
getAltBody(): string;
getCharset(): string;
getAttachments(): array;
_THE WAY THIS WORKS IS KIND OF LIKE THIS:_
$mail = new PhpMailer(/$host, $port,
$type/); // PhpMailer implements MailerInterface
$mail->setDebug(/false/);
$mail->withDkim('designcise.com[1]', 'default');
try {
$eml = new Email(/$to, $from/); // Email implements EmailInterface
$eml->setReplyTo(/$reply_to/);
$mail
// compose method returns Message Object
// (which is instantiated in /$eml/ Obj Constructor)
->compose(/$eml/)
// so now we can set Message Object properties:
->setSubject(/$subject/)
->write(/$msg/);
// and send email
$mail->send();
} catch(Exception $e) {
// ...
}
I took some inspiration from the Yii2 Framework[2], other than that
I couldn't find any meaningful implementations.
On Thursday, August 2, 2018 at 3:58:38 AM UTC+5, Larry Garfield wrote:
On Sunday, July 29, 2018 4:07:49 AM CDT [email protected][3] wrote:
I think it would be a good idea to have a set of interfaces to create a
standard for email libraries (such as PHPMailer, SwiftMailer,
etc.); anyone
agree?
In concept it sounds similar to PSR-7/PSR-17. You'd have a value
object for
the email message, and a fronting interface for a thing that sends
a message.
Whether there's value to that or not would depend mainly on if PHPMailer,
SwiftMailer, etc. were interested in standardizing on such an
interface. If
so, yes. If they're not interested, then there wouldn't be much
point to it.
--Larry Garfield
--
You received this message because you are subscribed to the Google
Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/php-fig/c1e50c83-d173-490a-89cc-d952f5270af9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/php-fig/CAESZFtLSDeMDuYRAJXz8zAYmDN-BQGJUO0X3mDZmkCJwc-rxHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Links:
------
[1] http://designcise.com
[2] https://github.com/yiisoft/yii2-framework/tree/master/mail
[3]
-------------------------
Jan Schneider
The Horde Project
https://www.horde.org/
--
You received this message because you are subscribed to the Google Groups "PHP
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/php-fig/20180802071047.Horde.S-S6FjVVl5jkAu5sNsxluG-%40yunosh.horde.org.
For more options, visit https://groups.google.com/d/optout.