Highlighted

CFSCRIPT new mail() - how to format attributes

LEGEND ,
Mar 12, 2018

Copy link to clipboard

Copied

Hello, all,

I've worked with mail() in cfscript, before, but I've always used it as such:

newMail = new mail();

newMail.setTo("user@domain.com");

newMail.setFrom("anotheruser@anotherdomain.com");

newMail.setType("html");

I'm trying to use setAttributes(), but the Adobe docs don't mention anything about how the name/value pairs are formatted.

Is it like newMail.setAttributes(to="user@domain.com", from="another@another.com", type="html"); ???

Or do I need to use {} around the name and values?

Please provide an example.

V/r,

^ _ ^

I played around with it.

The correct format is:

thisMail = new mail();

thisMail.setAttributes({

    to = "user@domain.xyz",

    from = "another@user.abc",

    subject = "This is a test",

    type = "html"

    });

OR, optionally:

thisMail = new mail({

    to = "user@domain.xyz",

    from = "another@user.abc",

    subject = "This is a test",

    type = "html"

    });

V/r,

^ _ ^

Views

153

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

CFSCRIPT new mail() - how to format attributes

LEGEND ,
Mar 12, 2018

Copy link to clipboard

Copied

Hello, all,

I've worked with mail() in cfscript, before, but I've always used it as such:

newMail = new mail();

newMail.setTo("user@domain.com");

newMail.setFrom("anotheruser@anotherdomain.com");

newMail.setType("html");

I'm trying to use setAttributes(), but the Adobe docs don't mention anything about how the name/value pairs are formatted.

Is it like newMail.setAttributes(to="user@domain.com", from="another@another.com", type="html"); ???

Or do I need to use {} around the name and values?

Please provide an example.

V/r,

^ _ ^

I played around with it.

The correct format is:

thisMail = new mail();

thisMail.setAttributes({

    to = "user@domain.xyz",

    from = "another@user.abc",

    subject = "This is a test",

    type = "html"

    });

OR, optionally:

thisMail = new mail({

    to = "user@domain.xyz",

    from = "another@user.abc",

    subject = "This is a test",

    type = "html"

    });

V/r,

^ _ ^

Views

154

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 12, 2018 0
LEGEND ,
Mar 12, 2018

Copy link to clipboard

Copied

I played around with it.

The correct format is:

thisMail = new mail();

thisMail.setAttributes({

    to = "user@domain.xyz",

    from = "another@user.abc",

    subject = "This is a test",

    type = "html"

    });

OR, optionally:

thisMail = new mail({

    to = "user@domain.xyz",

    from = "another@user.abc",

    subject = "This is a test",

    type = "html"

    });

V/r,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 12, 2018 0