Link to home
Start Free TrialLog in
Avatar of IShiva
IShiva

asked on

Sending email with Coldfusion

Hey guys,

I have an Access database with an 'email' field with address entered for client opt-in marketing for our company. How can I send a mass email (html) to all of them at once. I'm not sure about all the steps involved to acheive this. Can someone help me out? I want it to look like something similar to this:

Dear {firstname} {lastname},

HTML email body.

Sincerely,

Me

Also, will any of this be considered spam since its a "mass email"? There are about 400 clients we want to send this too. We dont want to get into any trouble. Your help is greatly appreciated!

IShiva
Avatar of mrichmon
mrichmon

You don't want to send to all at once or it WILL be considered spam.

You can send each one an individual mail and then it MAY be spam.

The key to whether or not it is spam is:

You can send a person an email if :
1) It directly relates to a transaction you had with them
2) WHen you collected their email address you told them that you might send them emails like this and gave them the option to opt out.


Those are not spam.

Otherwise it could be considered spam.

In any case you need to have a way for them to unsubscribe AND a physical contact address to follow all spam laws.


Now for how to do it.

<cfquery datasource="mydsn" name="GetEmails">
SELECT email from mytable
</cfquery>

<cfloop query="getemails">
<cfmail to="#email#" from="youremail@yourdomain.com" subject="your subject">
BODY goes here
</cfmail>
Avatar of pinaldave
Hi IShiva,
I was working in the 'newletter' *wink* company before and we used www.coolfusion.com 's IMS mail server.
It was very good and for one thread it is free also. what we did was added one more variable in all the mails so they become unique mails and not mass emails.
you can use the same idea here to add some variable in your text of the email.
well as mrichmon said if it is unsoliciated it is still a spam.

Regards,
---Pinal
Avatar of IShiva

ASKER

Thanks for the posts,

Pinal--can you explain a little more about this coolfusion.com? I went to their site but was confused as to what they actually do?

As for spam, the email addresses we collect are from clients that we verbally have communication with at some point. We dont ask them or they dont fill out anything to tell us that it is ok to send them emails. (although we should) These addresses are not bought, they are gathered verbally. I am not  new to spam but am new and quite confused about the laws.

mrichmon--ok that code makes sense...but how do i run it?

thanks again guys!

IShiva
ASKER CERTIFIED SOLUTION
Avatar of mrichmon
mrichmon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of IShiva

ASKER

mrichmon,

the above code works great...however i should have specified that these will be html emails. when i insert my html code, and execute the code, i get the emails...except the html code is visible...there are some links and graphics within the email that i want to send. How can i incorporate html into the above code?

sorry about that, i should have mentioned that earlier

IShiva
you need to add

type="html"

here:

<cfmail to="#email#" from="youremail@yourdomain.com" subject="your subject" type="html">
Avatar of IShiva

ASKER

ok thanks ill give it a try now
Avatar of IShiva

ASKER

THANKS...it works like a charm!!

I appreciate your time mrichmon

IShiva
no problem.

good luck :o)
Avatar of IShiva

ASKER

mrichmon,

one more quick question, in the line:
<cfmail to="#email#" from="youremail@yourdomain.com" subject="your subject" type="html">

do i have to put an email address in the 'from' field, or can I simply put a name....for eg:
<cfmail to="#email#" from="My Company Name" subject="your subject" type="html">

IShiva
You must have a valid email address or it iwll not send
Avatar of IShiva

ASKER

ok thanks much!

IShiva