Thread: Email

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    5
    Rep Power
    0

    Email


    I have a coldfusion webpage designed by a programmer taht is no longer with us. The webpage goes to the database and query the number of email sent to users based on the publication of documents. The page also has a link that gather all the email addresses on the list and open an Outlook email with all of the addresses in the "Bcc" field. This feature allows users to comunicate updates on the published documents. So far the page works fine and returned the list of email addresses, but the link to create an email does not always works. The code works fine becuase it works sometimes, connectivity is fine too since it brings out the list of emails, the database weeds out any bad email addresses so that is not the issue. I am not a CF developer, i was just assigned to fix the problem. Any idea or thoughts which areas I should be looking to fix the problem? Thanks in advance.
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,307
    Rep Power
    972
    You'll have to explain further. When you say it "does not always work", is there an error? Is it repeatable with a specific set of email addresses?

    I realize you're not a CF developer, but I just wanted to mention that relying on browser features like launching an email program when clicking a link is really not a good way to do this. Typically, this would be done by generating and sending the email with ColdFusion, using the CFMAIL tag.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    5
    Rep Power
    0
    The programmer uses the "CF Mail" tag to create the email, that is what happened on the background, but what the user sees is a link. What this email CF Mail does is opening an Outlook email with all the email addresses returned by the query already in the message. Regarding your question about the error message, it does not returns any. Once you click on the link nothing happens (but just for some, it works sporadically.
  6. #4
  7. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,307
    Rep Power
    972
    I think you're mistaken, the CFMAIL tag actually sends email (documentation). What you're seeing is the built-in browser behavior to open an associated program when a link with a specific format is clicked on (example). I would speculate that the link being used in your mailto isn't being properly formatted or escaped, and that is causing the browser to fail to interpret it correctly. That's why I asked if it was repeatable with a specific set of email addresses.

    You could try wrapping the output that creates the links in URLEncodedFormat to see if that helps properly format the values in the link.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    5
    Rep Power
    0
    I am not a developer, but I have the basic training on Coldfusion. I looked at the code and the CFMail tag is clearly used to perform that function. When i looked at the code the link its clearly ref to that tag. I will check about the specific set of email addresses.
  10. #6
  11. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,307
    Rep Power
    972
    It may help if you could post some code (just the relevant code please). If you're clicking a link and having your email program open to show the email and allow you to press Send, then something must be going on in the code. CFMAIL runs only on the server, and sends out email automatically. It doesn't open anything on the client side. If something is opening on the client side, then something else is going on.

    Does the link you are clicking look like:

    Code:
    <a href="mailto:someone@microsoft.com?subject=Hello%20again"> Send Mail</a>
    With "mailto" in the href attribute?
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    5
    Rep Power
    0
    Thank for you help kiteless, here is the portion of the code that send the email:

    <cfoutput><b>#getsolsub.doc_cd# #getsolsub.doc_dept_cd# #getsolsub.doc_id#</b><br><br>#counter# emails sent <!---on #dateformat(getsolsub2.dt_tm_sent, "mm/dd/yyyy")#---><br><br></cfoutput>
    <cfoutput><a href="mailtourchinfo@ci.austin.tx.us?subject=#getsolsub.doc_cd# #getsolsub.doc_dept_cd# #getsolsub.doc_id#&bcc=#email_list#">Send an email to all vendors using Outlook</a></cfoutput>
    </cfif>
    </div>

    <tr><td>&nbsp;</td></tr>
    <tr><td colspan="6" align="center"><cfoutput><a href="bdsolsubdispexcel.cfm?<cfif #email_date# is not "">email_date_month=#email_date_month#&email_date_day=#email_date_day#&email_date_year=#email_date_y ear#&amnd_no=#amnd_no#<cfelse>sol=#getsolsub.doc_cd#_#getsolsub.doc_dept_cd#_#getsolsub.doc_id#&amnd _no=#amnd_no#</cfif>"></cfoutput><img src="excel.gif" alt="Download Data To Excel" border="0"></a>&nbsp;<cfoutput><a href="bdsolsubdisppdf.cfm?<cfif #email_date# is not "">email_date_month=#email_date_month#&email_date_day=#email_date_day#&email_date_year=#email_date_y ear#&amnd_no=#amnd_no#<cfelse>sol=#getsolsub.doc_cd#_#getsolsub.doc_dept_cd#_#getsolsub.doc_id#&amnd _no=#amnd_no#</cfif>"></cfoutput><img src="pdf.gif" alt="Download Data To PDF" border="0"></a></td></tr>
    </cfif>
    </table>


    Please let me know if you need any other part of the code.
  14. #8
  15. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,307
    Rep Power
    972
    Exactly, this is a mailto link, not cfmail. You want the link to look like this:

    <a href="mailto:urchinfo@ci.austin.tx.us&subject=#URLEncodedFormat('#getsolsub.doc_cd# #getsolsub.doc_dept_cd# #getsolsub.doc_id#')&bcc=#URLEncodedFormat(email_list)#">Send an email to all vendors using Outlook</a>

    The problem is almost certainly the use of unescaped values in the subject or the email list, so use URLEncodedFormat to wrap them and escape any characters that are invalid for a URL.

    Comments on this post

    • medialint agrees
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    5
    Rep Power
    0
    Thanks i will try that and see if it works.

IMN logo majestic logo threadwatch logo seochat tools logo