EasyCFM.COM ColdFusion Forums / Coding Help! / Email addys missing?

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Email addys missing?

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

pvr_uk
04-10-2003 @ 6:35 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 8
Joined: Apr 2003

I've tried to create an email list for a newsletter, but although the form to add an email seems to work, there does not seem to be any result when I use a query to read the email address.
The email is defined as a text field in the table, and I've been using the Newsletter tutorial at EasyCFM.com

Any ideas?(Something simple I'll bet)

Thanks,
john


----------------
www.pvruk.co.uk
----------------

pvr_uk
04-10-2003 @ 9:31 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 8
Joined: Apr 2003

Well, I can now access the emails using a simple CFOUTPUT, but I'm still not receiving my test emails when I use CFMAIL

----------------
www.pvruk.co.uk
----------------

CJ
04-10-2003 @ 11:23 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4262
Joined: Oct 2002

post some code samples please.  really hard to debug otherwise Smile



CJ
@ #coldfusion/DALNet
http://charlie.griefer.com

pvr_uk
04-11-2003 @ 5:32 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 8
Joined: Apr 2003

Ok, sorry. Here's the code for the SendNewsletter:

<CFIF IsDefined("Message")>
      <CFQUERY NAME="GetMembers" DATASOURCE="pvr_uk">
       SELECT *
         FROM Newsletter

        WHERE emailType = 0

     ORDER BY memberID
    </CFQUERY>
      <CFQUERY NAME="GetHipMembers" DATASOURCE="pvr_uk">
       SELECT *
         FROM Newsletter

        WHERE emailType = 0

     ORDER BY memberID
    </CFQUERY>
            <CFMAIL QUERY="GetMembers"
          To="#GetMembers.email#"
                From="newsletter@mysite.com"
                Subject="This Week's Newsletter!">

                #FORM.Message#
                Sent: #DateFormat(Now(), 'ddd. mmmm dd, yyyy')#
                to Unsubcribe visit: http://www.mysite.com/unsubscribe.cfm

            </CFMAIL>


            <CFMAIL QUERY="GetHipMembers"
          To="#GetHipMembers.email#"
                From="newsletter@mysite.com"
                Subject="This Week's Newsletter!"
                type="HTML">

                #FORM.Message#
                Sent: #DateFormat(Now(), 'ddd. mmmm dd, yyyy')#
                to Unsubcribe visit: http://www.mysite.com/unsubscribe.cfm

            </CFMAIL>




     <H1>Newsletter Sent!</h1>

<CFELSE>
    <form action="sendnewsletter.cfm" method="post">
        The Message: <Textarea Name="Message"></textarea><BR>
        Send as:
        Text <input type="Radio" name="emailType" value="1">
        HTML <input type="Radio" name="emailType" value="0"><br>
        <input type="Submit" Value="Mail Newsletter">
    </FORM>
</CFIF>


----------------
www.pvruk.co.uk
----------------

CJ
04-11-2003 @ 9:29 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4262
Joined: Oct 2002

well, your two cfmail tags are based off of two seperate cfqueries.

are you sure that those cfqueries are returning any records (ie are there rows in the db where emailType = 0)?  To check, do a <cfoutput>#queryName.recordCount#</cfoutput> after the two cfqueries, and before the cfmail (and of course, replace queryName with the actual name of the query) Smile

Also, in looking at your code, i'm not quite sure what the purpose of the two queries is.  they're both exactly the same, and will return the exact same records.



CJ
@ #coldfusion/DALNet
http://charlie.griefer.com

Redman
04-11-2003 @ 10:44 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 7
Joined: Apr 2003

after you sort out your missing addys.........just a note on the proper use of the html variable in a cfmail tag. Okay on the premise that the message being sent in html form.........than we should format the message in proper html! Some mail readers have been known to balk at un-proper html in mail and just not show it period. Not a good thing so we toss in the needed page elements into the cfmail tag as well. Note if you want to use styles than this is where you would place them also......makes for an even prettier email. However if using styles remember to escape your pound signs in hex colors.........sample shows

<cfmail to="foo@foo.com" from="foo@foo.com" subject="Your request letter"
type="HTML">


<html>
<head>
<style type="text/css">
.myClass {
background-color: ##990033;
}
</style>
</head>

<body>
Hiyas<span class="myClass">Dude!</span>
</body>

</html>

</cfmail>


pvr_uk
04-14-2003 @ 9:03 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 8
Joined: Apr 2003

Ok, I've removed one of the querys to simplify the code, and put in something to output the record count and email addresses.
The result of running the code does show that there are emails there. I then inserted a direct email address as you can see in the code, but still no success.
I'm now asking my Host if there may be any problem from their end.
Thanks for all the help so far from everyone. Smile

<CFIF IsDefined("Message")>

           <CFQUERY NAME="GetHipMembers" DATASOURCE="pvr_uk">
       SELECT *
         FROM Newsletter
          ORDER BY memberID
         </CFQUERY>

     <cfoutput>Records: #GetHipMembers.recordCount#<BR></cfoutput>
     <cfoutput query="GetHipMembers">
          #email#<BR>
     </cfoutput>

            <CFMAIL QUERY="GetHipMembers"
          To="john.mcilroy@deuk.co.uk"
                From="newsletter@mysite.com"
                Subject="This Weeks Newsletter!"
                type="HTML">
          <html>
          <head>
          </head>
          <body>

                #FORM.Message#
                Sent: #DateFormat(Now(), 'ddd. mmmm dd, yyyy')#
                to Unsubcribe visit: http://www.mysite.com/unsubscribe.cfm

          </body>
          </html>
            </CFMAIL>




     <H1>Newsletter Sent!</h1>

<CFELSE>
    <form action="sendnewsletter.cfm" method="post">
        The Message: <Textarea Name="Message"></textarea><BR>
        Send as:
        Text <input type="Radio" name="emailType" value="1">
        HTML <input type="Radio" name="emailType" value="0"><br>
        <input type="Submit" Value="Mail Newsletter">
    </FORM>
</CFIF>


----------------
www.pvruk.co.uk
----------------

Redmanz
04-14-2003 @ 9:24 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 411
Joined: Oct 2002

when you talk to your server might be an idea to
get the server name and port number just incase on their particular setup your cfmail tag needs these values. In which case you would just add the values into the tag as such:

port="PortNumber"
server="mail.theirMailServer">


Coldfusion Applications available:
http://www.ideaz.ca/rez_productions/active_projects/index.htm

pvr_uk
04-15-2003 @ 3:59 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 8
Joined: Apr 2003

You may take me out and shoot me now!

I've just noticed that the emails will only send if I use my correct email address in the From field of the CFMAIL.

Blush

Thanks again for everyone's tips as I have learned quite a few other things from you all.

----------------
www.pvruk.co.uk
----------------

Redmanz
04-15-2003 @ 10:35 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 411
Joined: Oct 2002

gaaaaaaa baannnnnnnnng! hehe yeah I forgot about that one some servers do that, one of the other checks to include in your list if a cfmail tag don't work.


Coldfusion Applications available:
http://www.ideaz.ca/rez_productions/active_projects/index.htm


Website Designed and Developed by Pablo Varando.