CF9 Email multiple people from a CF grid selection

Hello everyone. As the name suggests i am trying to figure out in CF9 over MySQL how to send multiple emails based on selected records from a grid.
I have a table called sstblemailnewmembers
this has fields:
fldemailid (Int + Auto Incr)
fldemail (TEXT)
fldsent (DATE)
CHECKED (SET 'true','false' DEFAULT false)
I then have a cf query in my page called emailnewmembers.cfm
<cfquery name="emailnewmembers" datasource="SAPLIVE">
SELECT fldemailID, fldemail, fldsent, CHECKED
FROM sstblemailnewmembers
</cfquery>
So far so good (i think)
I then have a form defined:
<cfform action="AdminTransfer.cfm"
width="1170"
method="post"
enctype="multipart/form-data"
format="Flash"
preloader="true"
style="backgroundAlpha: 0;"
wmode="transparent"
timeout="3000"
name="adminhome"
onload="loadAS();">
the onload="loadAS();" bit is used so I can select multiple records using this script which is the next bit to be defined:
<cfformitem type="script">
function loadAS(){
_root.myGrid.multipleSelection = true;
</cfformitem>
and finally on this page we have the grid itself and the submit button as below:
<cfgrid name="myGrid"
selectmode="edit"
query="emailnewmembers"
rowheaders="no">
  <cfgridcolumn name="CHECKED" header="Select" type="boolean">
  <cfgridcolumn name="fldemailID" header="Email ID">
  <cfgridcolumn name="fldemail" header="Email Addrerss">
  <cfgridcolumn name="fldsent" header="Date Sent">
</cfgrid>
<cfinput type="submit"
name="sendemailnewmembers"
value="Send Emails"
style="#buttonStyle#">
So far so good i guess?
The submit button calls the action page defined in the form tag.
This is what I have so far defined in the action page "admintransfer.cfm"...
<cfif isdefined("FORM.endemailnewmembers")>
<cfloop index = "Counter" from = "1" to =
    #arraylen(Form.emails.CHECKED)#>
    <cfif Form.emails.CHECKED[counter] is "true">
      <cfquery name="emailnewmembers"
        datasource="SAPLIVE">
        UPDATE sstblemailnewmembers
        SET
        fldsent = NOW()
       </cfquery>
        <cfmail
        to = "#Form.fldemail#"
        from = "[email protected]"
        subject = "Welcome New Member">
        Dear New Member...
        </cfmail>
    </cfif>
  </cfloop>
</cfif>
So, if I select 3 records an email is getting sent 3 times to the last email address of the last record I select.
I am assuming there is something wrong with the loop and probably a better way to do this but I am quite new and this is the best I can come up with so if anyone cares to point me in the right direction I would be enormously gratful indeed

You could use this script. It will put the adresses in the To field, so you could either modify the script or just drag them across to the Bcc field.
AK
<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">(*Save the script in the Library/Scripts/Applications/Mail folder of your home directory. With several messages selected in Mail run
the script from the Scripts menu item on the menu bar. It will generate a new message with the sender of each of the selected
mails as a recipient, and the subject of the first selected mail as subject. Non-adjacent messages can be selected with Command-click.
AK Sep 2005 kinsella at itcarlow dot ie *)
using terms from application "Mail"
on perform mail action with messages TheMail
tell application "Mail"
set theSubject to ""
repeat with ThisMail in TheMail
set TheName to extract name from sender of ThisMail
set TheAddress to extract address from sender of ThisMail
if theSubject is "" then -- set subject, make message 1st time through
set theSubject to subject of ThisMail
if theSubject does not start with "Re:" then set theSubject to "Re: " & theSubject
set newMessage to make new outgoing message with properties {subject:theSubject}
end if
tell newMessage
make new to recipient at end of to recipients with properties {name:TheName, address:TheAddress}
end tell
end repeat
tell newMessage to set visible to true
end tell
end perform mail action with messages
end using terms from
using terms from application "Mail"
on run
tell application "Mail" to set sel to selection
tell me to perform mail action with messages (sel)
end run
end using terms from
</pre>

Similar Messages

  • How do i email multiple photos from iphoto

    how do i email multiple photos from iphoto?

    I have OSX 10.6.8 and use the Photo Browser from within the mail app to add iPhoto pics to emails.

  • Emailing multiple photos from camera roll

    Search threads but didn't find. Can multiple photos from camera roll be sent in an email on the iPhone 4

    In round about way yes.
    Go to photos.
    In thumbnail view click menu item (think moved to top right in iOS4) to enable multiselect.
    Select photos (up to 5 ... sorta) and then you can click share.
    The sorta part is that if you do more than 5 the share will go away, but you can still select more, then choose copy, then go open email and paste in more than 5.

  • Is there a way to email multiple files from pages

    I want to send multiple files from pages, cover letter and resume, but when I select both files, the share icon goes dull and it can't be selected. Is there a work around for this?

    Are you aware that someone without Pages cannot open the files? And that Pages will only run on OS X? Your best bet is do save the files as PDFs, then just drag the icons into your open email.
    Walt

  • Merge statement - update multiple columns from a single sub-select

    Is it possible to write in 10gR2, a MERGE statement, with UPDATE for multiple columns from a single sub_select?
    like this:
    MERGE INTO tableA
    using ( select * from temp) tmp
    on( tableA. col1 = tmp.col1)
    when matched then
    update set  ( tableA.col5,
                       tableA.col6,
                       tableA.col7) = ( select sum(col2), sum(col3), sum(col5)
                                                                                 from tableX
                                                                                where tableX.col1 = tableA.col1...)

    Hi,
    The USING clause is not a sub-query, so it can't reference columns from tables that are not in it.
    Include tableA in the USING clause if you really need to refer to it there. (It's not obvious that you do.)
    As always, it helps if you post:
    (1) The version of Oracle (and any other relevant software) you're using
    (2) A little sample data (just enough to show what the problem is) from all the relevant tables
    (3) The results you want from that data (In the case of a DML statement, such as MERGE, this will be the state of the tables when everything is finished.)
    (4) Your best attempt so far (formatted)
    (5) The full error message (if any), including line number
    Executable SQL statements (like "CREATE TABLE AS ..." or "INSERT ..." statements) are best for (2).
    If you can present your problem using commonly available tables (for example, tables in scott schema, or views in the data dictionary), then you can omit (2).
    Formatted tabular output is okay for (3).

  • Sending to multiple people from smtp

    Hi ,
    How can i actually send to multiple ppl using utl_smtp ?
    PROCEDURE send_test_message
    IS
    mailhost VARCHAR2(64) := 'mailhost.fictional-domain.com';
    sender VARCHAR2(64) := '[email protected]';
    recipient VARCHAR2(64) := '[email protected]';
    mail_conn utl_smtp.connection;
    BEGIN
    mail_conn := utl_smtp.open_connection(mailhost, 25);
    utl_smtp.helo(mail_conn, mailhost);
    utl_smtp.mail(mail_conn, sender);
    utl_smtp.rcpt(mail_conn, recipient);
    -- If we had the message in a single string, we could collapse
    -- open_data(), write_data(), and close_data() into a single call to data().
    utl_smtp.open_data(mail_conn);
    utl_smtp.write_data(mail_conn, 'This is a test message.' || chr(13));
    utl_smtp.write_data(mail_conn, 'This is line 2.' || chr(13));
    utl_smtp.close_data(mail_conn);
    utl_smtp.quit(mail_conn);
    EXCEPTION
    WHEN OTHERS THEN
    -- Insert error-handling code here
    NULL;
    END;
    how shld i add into the recipient ??
    i have tried
    1 - '[email protected],[email protected]';
    2 - '"[email protected]","[email protected]"';
    both does not seem to work
    kindly advise
    tks & rdgs

    You need to familiarise yourself with RFC821 - you'll find a copy at http://www.faqs.org/rfcs/rfc821.html
    Do not confuse SMTP (an application protocol) with the way an e-mail looks. E.g. the TO and FROM fields in an e-mail can say anything and have no bearing on to whom the e-mail was send to, and from who it came.
    Basically a "mail transaction" is a:
    MAIL FROM - identifies the sender (can easily be spoofed)
    RCPT TO - identifies a single recipient and can be repeated multiple times
    DATA - submits the header and body of the e-mail
    Read the RFC - it explains this in detail.

  • How can I email multiple files from Pages?

    I want to semd out a cover letter and resume, yet when I select more than one file the share icon dulles out and can't be selected. Is there a work around for this?

    Until Apple releases a version of Pages that allows multiple attachements you could use GoodReader application to get two documents onto one Mail document.
    It is convoluted, but does work.
    First, in Pages,  SHARE>EMAIL each document to yourself  (it will take two or more Mails) then (assuming you have GoodReader installed) open each email and press-and-hold on the attachement until you see the dialogue "Open In..." and then select "Open In... GoodReader"; do this for each attachment. Then in GoodReader, open MANAGE FILES and select all the attachments and hit E-Mail from GoodReader, it can send multiple attachments in MAIL.
    Since you are sending a resume, I strongly recommend sending your self a trial run to ensure all the attached documents appear correctly before sending them to a prospective new employer. Sometimes things don't work as planned; better to catch them first.
    Good luck.

  • Email multiple spools from background job - SM36 using Spool List recipient

    I create a background job using Spool List Recipient to email me the reports. The program that I scheduled to run creates 2 spools. When the spools are sent via email, only the last spool is sent.
    Please advise on how I can get the 2 spools sent via email.

    i would not use the Spool List recipient from Job and use the function RSPO_SPOOLJOB_TO_OFFICE in your Program instead.
    tell me if it helps.
    Regards,
    Laurent

  • How to email multiple images from Aperture?

    When I click the email button, only the primary select is sent to mail. How can I email several images at once?
    Thanks for your help.
    Nicolas

    You know you can access your Aperture Library in the New Message Window in Mail on 10.5?
    Uploaded with plasq's Skitch!
    You can then drag multiple pics over to the Window.

  • How to email multiple notes from icloud

    I do not see any export all function for Notes (unlike Contacts where you could select all and export).
    Do I have to email all my notes one by one? Is there a quicker way to downlad all the notes to my PC?
    Thanks.

    Unfortunately, there isn't.  You have to email them one by one.

  • Trying to display multiple people from different titles

    Get-ADUser -Filter {Title -like "Director"}
    This is what I've come up with. I want to display more than just director but I don't know how
    to do that.
    I have tried to use spaces and other things but I am not sure what im doing wrong.

    -filter {Title -eq 'Director' -or Title -eq 'Other  guy' -or Title -eq 'Dudes who rock'}
    help get-aduser -par filter
    ¯\_(ツ)_/¯

  • When I email myself a picture from my iphone 4s, the email is sent from an email account that I don't have set up as the default account. How can I set it up so that the emails are coming from the default account selected in Mail?

    Under my mail tab, it shows that I have a specific email account set up as a default account. That is the account I would like for me emails to be sent from. But when I actually send out an email such as a picture, it is being sent from one of my different email accounts that is not set up as the default. How can I change this so that future messages will be sent from the default account? Any advice would be appreciated. Thanks!!

    All photo attachments received or sent with the iPhone's Mail app appear inline or viewed in place within the body of the message when viewed with the iPhone's Mail app which is the same with the Mail.app on a Mac. A photo attachment that appears inline or viewed in place does not mean the photo was not sent as a true attachment to the message. A photo attached to a message with the iPhone's Mail app is sent as a true attachment to the message. How an inline or viewed in place attachment appears on the recipient's end depends on the recipient's email client. If the recipient's email client does not support viewing an attached photo inline or viewed in place within the body of the message, the attached file must be manually selected and opened to viewed.
    I am getting the email with the Picture Inline ( not as attachment),The picture is shown distorted , no metter what i do and with what mail client i am using (Gmail\Hotmail\My Enterprise exchange mail), i still get the same behavior.
    With which email client?

  • Retrieving multiple values from one column in SELECT statement

    Hi,
    I have a slight dilemma in that I'm trying to pull down all the values from a column from a select statement that includes some JOINS in it.
    If I run the query at the SQL Plus prompt, it pulls back all the values/rows.
    When I run the select (and prepared ) statement in my JSP, it only pulls back one of the 4 values I'm trying to retrieve.
    e.g.
    at the DB level :
    SELECT role_name, CC_ID FROM votetbl a
    INNER JOIN APPROVERS b ON
    a.BUSVP = b.BUSVP AND
    a.BRANCH = b.BRANCH
    WHERE CC_ID = 1688this will return:
    ROLE_NAME CC_ID
    ops 1688
    ops 1688
    comply 1688
    legal 1688
    comply 1688
    When run in my JSP, like so:
    String primID3a = request.getParameter("primID");
    Statement stmtovoter = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
    String prepvotSQL = "SELECT role_name, CC_ID FROM votetbl a INNER JOIN APPROVERS b ON a.BUSVP = b.BUSVP AND " +
                         "a.BRANCH = b.BRANCH WHERE CC_ID = ?";
    PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
    prepvotstmt.setString(1, primID3a);
    ResultSet rest3 = prepvotstmt.executeQuery();
    rest3.next();
    String votecat = rest3.getString(1);
    out.println("Vote category: "+votecat);I only get ops returned.
    Do I need to run an enumerator? Or reqest.getParameterValues or use a while statement around the results set?
    Any feedback and direction here is welcomed!
    Thanks!

    Actually, I tried looping and still only get 1, but returned several times.
    i.e.
    PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
    prepvotstmt.setString(1, primID3a);
    ResultSet rest3 = prepvotstmt.executeQuery();
    rest3.next();
    String votecat = rest3.getString(1);
    while (rest3.next()) {
    out.print("category roles "+votecat);
    }then I get returned the following:
    admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admin
    like so.
    Where as at the DB level I get
    ROLE_NAME CC_ID
    admin 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    risk 1688
    comply 1688
    legal 1688
    legal 1688
    ops 1688
    comply 1688
    Maybe the while should go around the getString(1) designation? But I was thinking I'd tried that and gotten invalid cursor error
    Something is definitely amiss, between the prepared statement in the servlet and the SELECT statement at the DB level.
    I can totally hardcode the statement in the servlet or JSP and it will return one value potentially several times, but only one.
    Other times, it will not return a value at all, even though one resides in the db.
    Yet go to the DB/SQL Plus prompt and it returns perfectly. I can simply copy and paste the SELECT statement from the out.print line I made and it works like a champ in SQL Plus. Any ideas why the same exact thing cannot return the proper values within the servlet/JSP?
    Yeeeeeeesh!!! : (
    Message was edited by:
    bpropes20

  • How do I open multiple locations from the History after selecting them with Ctrl+click?

    Let's say I want to read some of the Mother Jones and Alternet articles I'd linked to from e-mails over the past in two months. I open my Firefox history. I do a search of the history libary to get a list of all the relevant locations. Then I use Control+click to select the few articles I want to read. I'd think Ctrl+O would open all those selected, but it doesn't. There must be a more efficient way than what I'm doing now, which is to open a new tab in the browser window, go to history, double click one line, wait for the page to load; open a new tab, go back to the history search results, click on a new location, wait as it loads, repeat.

    Where are you viewing your History? <br />
    Have you tried the History Sidebar? {Ctrl + H} <br />
    You can {Ctrl + Click} the pages you want to open in new Tabs, one at a time. <br />
    Also, if you have your Options > Tabs pref deselected for '''When I open a new tab, switch to it immediately''', it might be less distracting with all those pages opening in the background.

  • How to get multiple values from the db using select

    hi all,
    i am using oracle 9i database
    i created a procedure
    create or replace procedure sample_proce
    as
    to_i varchar2(50)
    begin
    select to_id into to_i from sample where flag in('y');
    dbms_output.put_line('hai'|| to_i);
    end;
    when i executed this procedure the following error occurred.
    error at line 5 fetching too many rows.
    but when i execute the select query alone i can able to view all the rows.
    how to resolve it

    i used the following procedure
    create or replace procedure sample_proc
    as
    begin
    for s in(select to_id from sample where flag='y')
    loop
    dbms_output.put_line(s.to_id);
    end loop.
    end;
    it is executed fine. i can able to fetch all the rows.
    how to pass all these values into the another procedure.
    we usually pass only one value into another procedure, i do no how to pass all the values . please help me.
    Thank u.

Maybe you are looking for

  • Dell U2311H and Powermac G5

    Alright folks, I just scored a **** of a deal on Craigslist. I got a nearly new Dell U2311H 23" IPS display for 100 bucks. I've discovered a little problem though. For some reason the VGA connection works perfectly fine with a VGA to DVI adapter on t

  • I can't remove a Planning Data Source.

    Hello, I'm trying to delete a DataSource that was associated with a Planning application. The planning application was delete and no references remains in shared services, essbase or any component. But i can't delete the datasource, only "edit" optio

  • X6 mass memory full error

    I want to copy some MP3 files to the X6 phone mass memory through windows explorer but it give me a memory full error message. Before I start to copy, it indicated 8.40G free out of 15.0G (not sure why it is 15G), but once I start to copy, it pops up

  • How to remove a camera calibration profile in LR5

    Hi, I normally generate a new camera calibration profile by x-rite everythime I change the light settings. This gives rise to a lot of camera calibration profiles in LR5. How to erase them after use?

  • MacBook Pro-blem 2011 stuttering startup

    Recently when starting up in maverick I have about 25 mins of harddrive stuttering.  Past the ~25mins things seem to return to normal.  Bootcamp doesn't exhibit any such problems.  Is my harddrive on its death throne? Or can this be remedied ?  Pleas