Results 1 to 2 of 2

Thread: Query to get e-mail addresses for contacts and leads

  1. #1
    sbantz is offline Sugar Community Member
    Join Date
    Sep 2007
    Posts
    52

    Default Query to get e-mail addresses for contacts and leads

    Is there an easy way to extract e-mail addresses for all Contacts and Leads? The way I have been doing it is rather cumbersome in that I have to change the view to show 5000 records and then do an export of Contacts and open the CSV file in Excel to delete the columns I don't need/want. Then, I do this again for Leads.

    I want to have a single column list of e-mail addresses so that I can upload this to ConstantContact.com for our newsletters. I should mention that I do have Zucker Reports installed if that gives me a good starting point.

    Thanks in advance.

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Query to get e-mail addresses for contacts and leads

    Hi sbantz

    You can run this query on phpMyAdmin

    Code:
    (
    SELECT 'Leads' AS module, TRIM( CONCAT( IFNULL( l.first_name, '' ) , ' ', IFNULL( l.last_name, '' ) ) ) AS name, ea.email_address AS email
    FROM leads AS l
    INNER JOIN email_addr_bean_rel AS eabr ON l.id = eabr.bean_id
    AND eabr.bean_module = 'Leads'
    AND eabr.deleted =0
    INNER JOIN email_addresses AS ea ON eabr.email_address_id = ea.id
    AND ea.deleted =0
    )
    UNION (
    
    SELECT 'Contacts' AS module, TRIM( CONCAT( IFNULL( c.first_name, '' ) , ' ', IFNULL( c.last_name, '' ) ) ) AS name, ea.email_address AS email
    FROM contacts AS c
    INNER JOIN email_addr_bean_rel AS eabr ON c.id = eabr.bean_id
    AND eabr.bean_module = 'Leads'
    AND eabr.deleted =0
    INNER JOIN email_addresses AS ea ON eabr.email_address_id = ea.id
    AND ea.deleted =0
    )
    Regards
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. e-mail addresses disappear?!?
    By totalfinancialfreedom in forum General Discussion
    Replies: 7
    Last Post: 2009-06-04, 12:22 PM
  2. Employee E-mail addresses
    By AEsposito in forum Help
    Replies: 3
    Last Post: 2008-06-26, 12:20 AM
  3. can't send mail to external email addresses
    By nylarosie in forum Help
    Replies: 7
    Last Post: 2008-06-09, 08:57 PM
  4. target/leads email addresses..
    By jheizhee in forum Help
    Replies: 1
    Last Post: 2008-05-15, 02:39 AM
  5. website addresses in leads
    By kingsolomon76 in forum Feature Requests
    Replies: 3
    Last Post: 2006-11-22, 11:56 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •