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
IShivaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mrichmonCommented:
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>
0
pinaldaveCommented:
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
0
IShivaAuthor Commented:
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
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

mrichmonCommented:
"adding one more variable in all the mails so they become unique mails" does not  make it not mass email.

Most spam programs have some content change per message so it won't be *detected* as spam by the server it is being sent from, but that does not mean it is not spam and still could be illegal.


To run it you basically type the above code into your cold fusion page.

SOmething like:


<cfif isDefined("Form.SendEmail")>
<cfquery datasource="mydsn" name="GetEmails">
SELECT firstname, lastname, email from mytable
</cfquery>

<cfloop query="getemails">
<cfmail to="#email#" from="youremail@yourdomain.com" subject="your subject">

DEAR #firstName# #LastName#

#emailbody#

SIncerely,
Your Name

</cfmail>
</cfloop>
<html>
<body>
Emails sent
</body>
</html>
<cfelse>

<html>
<body>
<form action="thispage.cfm" name="myform">
Click to send the emails
<input type="submit" name="SendEmail" value="Send Email">
</form>
</body>
</html>
</cfif>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IShivaAuthor Commented:
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
0
mrichmonCommented:
you need to add

type="html"

here:

<cfmail to="#email#" from="youremail@yourdomain.com" subject="your subject" type="html">
0
IShivaAuthor Commented:
ok thanks ill give it a try now
0
IShivaAuthor Commented:
THANKS...it works like a charm!!

I appreciate your time mrichmon

IShiva
0
mrichmonCommented:
no problem.

good luck :o)
0
IShivaAuthor Commented:
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
0
mrichmonCommented:
You must have a valid email address or it iwll not send
0
IShivaAuthor Commented:
ok thanks much!

IShiva
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.