Code Monkey home page Code Monkey logo

wiremailsmtp's Introduction

WireMailSmtp

ProcessWire: a extension to the WireMail base class that uses SMTP-transport

Only functional with ProcessWire Version 2.4.1 or greater

This module integrates EmailMessage, SMTP and SASL php-libraries from Manuel Lemos into ProcessWire.

More information and code examples


Current Version 0.6.1

List of all options and features

testConnection () - returns true on success, false on failures

debugSend () - send the mail(s) and output or return verbose messages of the complete connection and sending process

sendSingle ( true | false ) - default is false

sendBulk ( true | false ) - default is false, Set this to true if you have lots of recipients (50+)

to ($recipients) - one emailaddress or array with multiple emailaddresses

cc ($recipients) - only available with mode sendSingle, one emailaddress or array with multiple emailaddresses

bcc ($recipients) - one emailaddress or array with multiple emailaddresses

from = '[email protected]' - can be set in module config (called Sender Emailaddress) but it can be overwritten here

fromName = 'Name Surname' - optional, can be set in module config (called Sender Name) but it can be overwritten here

priority (3) - 1 = Highest | 2 = High | 3 = Normal | 4 = Low | 5 = Lowest

dispositionNotification () or notification () - request a Disposition Notification

subject ($subject) - subject of the message

body ($textBody) - use this one alone to create and send plainText emailmessages

bodyHTML ($htmlBody) - use this to create a Multipart Alternative Emailmessage (containing a HTML-Part and a Plaintext-Part as fallback)

addSignature ( true | false ) - the default-behave is selectable in config screen, this can be overridden here. (only available if a signature is defined in the config screen)

attachment ($filename, $alternativeBasename = '') - add attachment file

send () - send the mail(s) and return number of successful send messages

getResult () - returns a dump (array) with all recipients (to, cc, bcc) and settings you have selected with the message, the message subject and body, and lists of successfull addresses and failed addresses,

logActivity ($logmessage) - you may log success if you want

logError ($logmessage) - you may log errors, too. - Errors are also logged automaticaly

useSentLog (true | false) - intended for usage with e.g. third party newsletter modules - tells the send() method to make usage of the sentLog-methods

sentLogReset () - starts a new Session. Best usage would be interactively once when setting up a new Newsletter

sentLogGet () - returns an array containing all previously used emailaddresses

sentLogAdd ($emailaddress) - is called automaticly within the send() method

wrapText (true|false) - default is true

More information and code examples

wiremailsmtp's People

Contributors

abdusco avatar horst-n avatar janromero avatar netcarver avatar notanotherdotcom avatar romaincazier avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

wiremailsmtp's Issues

Date issue WireMailSmtpAdaptor.php

There is a string formatting error on date string set on line 350 in WireMailSmtpAdapter.php

$this->emailMessage->SetHeader("Date", gmdate("D, j M Y H:i:s \G\M\T P"));

Systems strictly observing RFC2822, will not accept the addition of the (Difference to Greenwich time (GMT) with colon between hours and minutes )added to the end date string created.

This causes issues with systems like Amazon AWS SES, Rackspace Mailgun, among others.

Line 350 should be changed to.

$this->emailMessage->SetHeader("Date", gmdate("D, j M Y H:i:s \G\M\T"));

https://www.ietf.org/rfc/rfc2822.txt

Credit goes to Rackspace tech support for isolating this.

replyable queue

feature request/idea. A bit of a head scratch. I am experiencing issues with clients changing their email account passwords and as a result breaking the module sending.

One thing is to log the sending/connection errors but the messages are long gone too. So, how about an email queue implementation where all messages would queue up if they cannot be sent for some reason and then upon fixing the issue whatever it might be the admin could resend the queued emails again?

There is lots to do I guess but I thought I'd throw it out there.

ProcessWire namespace

Hi @horst-n I was wondering if at some point in the future (no rush) you'd consider adding a namespace ProcessWire; to this module's PHP/module files so that PW doesn't have to compile it? I understand you've got several 3rd party classes that are in the root namespace and may need to remain so, so any references to them would need to be changed to have a backslash in front of them, like this:

$this->emailMessage = new \smtp_message_class();

no authentication required

Maybe an edge case, but when my SMTP server does not require authentication, the module test fails.
This is actually a false positive, even though the module test fails, the module still sends email as expected.
The offending code is part of the smtp.php library:

if($success
&& strlen($mechanism)==0)
{ 
$this->error="it is not supported any of the authentication mechanisms required by the server";    
$success=0;
}

Is sender_signature plaintext or html text?

sender_signature is added as plaintext to the text body and as html to html body (https://github.com/horst-n/WireMailSmtp/blob/master/WireMailSmtpAdaptor.php#L277).

This is clearly a bug, and should be fixed by

a) making the user supply both html and plaintext signatures

OR

b) correctly escaping the (plaintext) sig when injecting it to html payload.

Maybe a) and b) could be combined so that one can supply (plaintext) sig, and optionally also an html one. If an html sig is not supplied, the plaintext one is converted to html by escaping.

The Envelope sender?

Hi, i send some email and add the sender with
$email_message->SetHeader("Sender", "$name <$email>");
But if the email is reject from the destination server the undelivered message go back to the user of the httpd process.
Can i set a real envelope sender?

Multiple CC only sending to To and last CC

As the title says, there's an issue with CC - no matter which way you do the CC's (array of email addresses, associative array of email addresses and names) only the last person in the CC and the person in the To ever gets the email.

I was testing this with 3 recipients and the first CC was skipped over for some reason.

Fatal error on latest version with php 8.2

Hi there,

I've just installed this awesome plugin that I'm using on pretty much all of my sites. But when testing whether the SMTP connection works, I'm getting the following error:

"Fatal Error: Uncaught Error: Class "WireMailSmtp" not found in site/modules/WireMailSmtp/WireMailSmtpAdaptor.php:143"

I'm using PW's latest dev version.

PHP 7.4 deprecated warning in email_message.php

…is it safe to just remove this part of the condition?

1Γ— PHP Deprecated: Function get_magic_quotes_runtime() is deprecated in .../smtp_classes/email_message.php:907

if((GetType($size)=="integer"&& strlen($body)>$size) || (function_exists("get_magic_quotes_runtime") && get_magic_quotes_runtime())) $body=StripSlashes($body);

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.