Welcome to Dream.In.Code
Getting Help is Easy!

Join 117,542 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,653 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



CF Mail

 
Reply to this topicStart new topic

CF Mail, I am not receiving my test mails...

parenteau
post 14 Feb, 2008 - 04:44 PM
Post #1


New D.I.C Head

Group Icon
Joined: 12 Feb, 2008
Posts: 28



Dream Kudos: 50
My Contributions


Hello All!!!
I am still trtying to work out some basics. Here is the email form I am testing on my coldfusion acct. to use in various places on the site. I can't seem to get any emails back though. I want to eventually make the form more complex... but I figured I should try to get this to function first. Anyway, I am having similar problems with my file upload form that I posted a topic on.... no-one has replied to that post yet... these may be similar issues... I havn't figured it out yet. Please forgive me for not understanding this code stuff yet.... once I do, I feel like I will be able to do some really creative stuff. Please help, some day I may be able to return the favor! Thanks.

CODE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Contact Us</title><style type="text/css">
<!--
.style2 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: #333333;
}
-->
</style></head>

<body><CFIF IsDefined("process")>
     <div align="center">
       <!--- Send the message to yourself, when the user posts it on your site. --->
       <CFMAIL to="email@mywebsite.com" from="#ContactEmail#" Subject="mail from mywebsite.com"server="mail.mywebsite.com" port="25"
username=“emai@mywebsite.com”
password=“emailpassword”>
        #ContactMessage#

        Message By: #ContactName# - #ContactEmail#
        ========================================
       </CFMAIL>

        <CFMAIL to="email@mywebsite.com" from="#ContactEmail#" Subject="mail from mywebsite.com" server="mail.mywebsite.com" port="25"
username=“emai@mywebsite.com” password=“emailpassword”>
        
         Thank you for your message,
         We'll be in touch as soon as we can, we receive hundred and thousands
         of emails a day; so we might take a while, but we'll reply!
        
         Thanks again for visiting our site,
         Michael Parenteau - Webmaster
         michael@intuitimaging.com.Com
        
         You wrote:
         #ContactMessage#
        
         Message By: #ContactName# - #ContactEmail#
         ========================================
       </CFMAIL>

    <table width="600" border="1" cellspacing="5" cellpadding="7">
  <tr bgcolor="#E7E7E7">
    <th width="126" scope="col"><img src="images/AEClogo(web).jpg" alt="" width="198" height="193" /></th>
    <th width="425" valign="middle" scope="col"><div align="center" class="style2">Thank You for your message. We will contact you as soon as possible.
      <hr size="1" /> <a href="#">Click here to go to the home page</a></div></th>
  </tr>
</table>

    <CFELSE>

     </div>
     <cfform action="contact.cfm" method="post">
    <input type="hidden" name="Process" Value="1">
    <table align="center" border="0" width="487">
<tr>
            <td width="20%" valign="top" align="right">Name:</td>
            <td width="80%"><cfinput type="text" name="ContactName" size="20" required="yes" message="Please Enter Your Name!"></td>
        </tr>
        <tr>
            <td width="20%" valign="top" align="right">Email:</td>
            <td width="80%"><cfinput type="text" name="ContactEmail" size="20" required="yes" message="Please Enter Your Email Address!"></td>
        </tr>
        <tr>
            <td width="20%" valign="top" align="right">Message:</td>
            <td width="80%"><textarea rows="4" name="ContactMessage" cols="50"></textarea></td>
        </tr>
        <tr>
            <td width="20%" valign="top" align="right"></td>
            <td width="80%"><input type="submit" value="Submit Contact Form"></td>
        </tr>
    </table>
    </cfform>

</CFIF>
</body>
</html>
User is offlineProfile CardPM

Go to the top of the page


parenteau
post 15 Feb, 2008 - 06:40 AM
Post #2


New D.I.C Head

Group Icon
Joined: 12 Feb, 2008
Posts: 28



Dream Kudos: 50
My Contributions


Did I post this wrong or can nobody see the problem here... I can't figure out what I am doing wrong.
User is offlineProfile CardPM

Go to the top of the page

sansclue
post 15 Feb, 2008 - 07:34 PM
Post #3


D.I.C Head

**
Joined: 21 Nov, 2007
Posts: 87



Thanked 4 times
My Contributions


QUOTE(parenteau @ 15 Feb, 2008 - 06:40 AM) *

Did I post this wrong or can nobody see the problem here... I can't figure out what I am doing wrong.


As far as I can see there is nothing the code per se. Assuming the email addresses are valid. There are a number of things that can effect whether or not mail works. The most common is firewall software blocking mail.

I do not know if you are running CF locally or using a shared host. If you are running it locally

1) First check the "undelivered folder" to see if your messages are there. By default, undeliverable mail is sent to the mail\Undelivr folder. Example
c:\ColdFusion8\mail\Undelivr

2) If the messages are there, check the error logs. You can view them by logging into the CF administrator or view them directly. By default logs are located in the \logs directory. Example c:\ColdFusion8\logs. Check the application.log and exception.log for mail related error messages.

You might see an error message like this, or at least one that will help indicate the cause.

CODE

"Error","scheduler-1","02/15/08","18:19:09",,"Unknown SMTP host: mail.mywebsite.com;   nested exception is:     java.net.UnknownHostException: mail.mywebsite.com"
javax.mail.MessagingException: Unknown SMTP host: mail.mywebsite.com;
  nested exception is:
    java.net.UnknownHostException: mail.mywebsite.com


3) Which version of CF are you using? The "server" attribute is an Enterprise Edition only feature. Though it should work in the Developer version too. If you are running "Standard" that might explain why it does not work

4) I would try a simple test (ie without all the html form code) just to make it easier to isolate the problem.

CODE

<cfset ContactEmail = "testContactEmail@somecompany.com">
<cfset ContactMessage = "Testing message">
<cfset ContactName = "Some One">

<CFMAIL to="email@mywebsite.com" from="#ContactEmail#"
    Subject="mail from mywebsite.com"
    server="mail.mywebsite.com" port="25"
    username="emai@mywebsite.com"
    password="emailpassword" >

    #ContactMessage#

    Message By: #ContactName# - #ContactEmail#
    ========================================
</CFMAIL>


User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/7/08 05:35PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month