Giter VIP home page Giter VIP logo

cbmailservices's People

Contributors

balbinoortus avatar bdw429s avatar daemach avatar djcard avatar elpete avatar eppinger avatar garciadev avatar gpickin avatar homestar9 avatar jclausen avatar jeff-chastain avatar lmajano avatar mbandizzle avatar michaelborn avatar richardherbert avatar robertz avatar ryanalbrecht avatar scottsteinbeck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cbmailservices's Issues

CBMailservices Exception if Email Contains Binary Attachment

I discovered an issue when playing around with the cbmailservices if an email has a binary attachment and the email fails validation, it will throw an exception via LogBox because Logbox can't handle binary data.

JSON serialization failure: Unable to serialize binary data to JSON.

coldbox\system\logging\LogEvent.cfc:82
coldbox\system\logging\appenders\ConsoleAppender.cfc:50
coldbox\system\logging\Logger.cfc:399
coldbox\system\logging\Logger.cfc:301
modules\cbmailservices\models\MailService.cfc:272

I'm not sure if Logbox will ever be able to handle binary data, so it might be a good idea to strip anything binary from mailParams as a precaution, just to be safe.

Here's how you can replicate the issue:

var email = mailService.newMail( 
    to = "", // intentionally blank
    from = "[email protected]",
    subject = "All Your Base Are Belong to Us",
    type = "html",
    body = "<p>Hello</p>
);

email.addMailParam(
    file = "my-document.pdf",
    content = toBinary( base64PdfFile ), 
    type = "application/pdf"
);

mailService.send( email );

Default-Settings overwrites Mail-Bean Payload

If "defaults" are set in the configuration, they overwrite the values in the passed payload of the mailbean.
This should be the other way round or have I misunderstood something here?

In mailservice.newMail() in line 246

structAppend( arguments, variables.defaultSettings );

# should be

structAppend( arguments, variables.defaultSettings, false );

templateDynamicFields in html attribute like href not working in html mail

When I set a property for templateDynamicFields as a URL,
And put this in the HTML attribute href of <A href=""> tag.. The mail wil not be submitted. without any errors. <a href="@niceUrlProperty@">test</a>

My mail settings:


mailData = {                
                    from: "[email protected]"
                    ,to: "[email protected]"
                    ,subject: "subject"
                    ,mailHtmlContent: Renderer.renderView(view='/mails/passwordActivationMail') 
                    ,templateDynamicFields: {activationUrl: "http://testwebsite.com/urltoapage/.."}
                };  
var newMail = MailService.newMail();

        //required
        newMail.setFrom(mailData.from);
        newMail.setTo(mailData.to);
        newMail.setSubject(mailData.subject);
        newMail.setFailTo(arguments.failTo);


        //fill the dynamic fields
        if(!structIsEmpty(mailData.templateDynamicFields)){
            newMail.setBodyTokens(mailData.templateDynamicFields);
        }
        //set html 
        newMail.setHtml(mailData.mailHtmlContent);

        //send the mail
        var result = mailService.send( newMail );
`

And the mail template:

    <!---  ************************************************************************************************************** --->
                                    <!--- BUTTON --->
                                    <!---  ************************************************************************************************************** --->
                                    <table class="btn-primary" cellpadding="0" cellspacing="0" border="0" style="font-family: Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 100%; line-height: 1.6em; color: ##757575; width: auto !important; Margin: 0 0 10px; padding: 0;">
                                        <tr style="font-family: Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 100%; line-height: 1.6em; margin: 0; padding: 0;">
                                            <td style="font-family: Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 14px; line-height: 1.6em; border-radius: 3px; text-align: center; vertical-align: top; background: ##3b8fbb; margin: 0; padding: 0;" align="center" bgcolor="##3b8fbb" valign="top">
                                                <a href="@activationUrl@" style="font-family: Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 100%; line-height: 2; color: ##ffffff; border-radius: 3px; display: inline-block; cursor: pointer; font-weight: bold; text-decoration: none; background: ##3b8fbb; margin: 0; padding: 0; border-color: ##3b8fbb; border-style: solid; border-width: 10px 20px;">click me!/a>
                                            </td>
                                        </tr>
                                    </table>

Parse tokens error when 'type' property does not exist

What are the steps to reproduce this issue?

  1. Create a new instance of the Mail.cfc object, passing a collection of parameters to the init method that does NOT include a 'type' parameter
  2. Attempt to send the Mail object ([object].send());

What happens?

An error is throw in the parseTokens method due to the recently added check for the mail type (line 380)

	// Do not process tokens if using dynamic template (send-grid-protocol)
	if ( arguments.mail.getType() == "template" ) return;
The property (Type) doesn't exist. Valid properties are leadId,mailParams,environment,mailParts,source,associationName,notes,customerId,agentId,subject,bodyTokens,to,additionalInfo,additionalJSONData,conversationMessageId,uniqueId,cc,from,fromName,body,bcc

What were you expecting to happen?

The code should execute without error, bypassing this check as there is no 'type' property defined on the object.

Any logs, error output, etc?

Any other comments?

What versions are you using?

Operating System:
Package Version: 2.8.1

Mailgun EU Region Domains

As currently coded the Mailgun protocol assumes a US region domain. If the domain is associated with the EU region it just returns "Forbidden", not even a JSON formatted string! As a result all call fails.

I've coded up a proposed solution that I'm currently using and will raise a pull request on this repo and one for the docs.

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.