+ Reply to Thread
Results 1 to 14 of 14

Send Email using Gmail to multiple "clients"

  1. #1
    Registered User
    Join Date
    11-11-2013
    Location
    Portgal
    MS-Off Ver
    Excel 2016
    Posts
    47

    Send Email using Gmail to multiple "clients"

    Hello everyone.... I need some help on this..... I have this code that is working already.... It will send and email with an attach file to one "client"....

    I know that if I want to add more "clients" I just need to input their emails, but I would like to have a worksheet named "Clients" with their emails and this code read those emails and send it automatically. I donīt know if you understand what Iīm trying to do???


    Please Login or Register  to view this content.

    You can use this code to send Gmail emailīs...... Itīs working perfectly.......

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Send Email using Gmail to multiple "clients"

    You can string together as many email addresses as you want, just separate them with a semicolon:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    11-11-2013
    Location
    Portgal
    MS-Off Ver
    Excel 2016
    Posts
    47

    Re: Send Email using Gmail to multiple "clients"

    JBeaucaire, I think you miss my point..... Maybe I donīt explained very good......

    First -> objEmail.to not objEmail.From

    Second -> I want that the code add the emails from a worksheet. Imagine that I have 1000 clients, but in the next 3 months I need to remove 50 and add more 150.... And itīs much more easy to manage the clients in a worksheet than in the code......


    But hey..... Thank you very much for your attention.....

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,909

    Re: Send Email using Gmail to multiple "clients"

    Adjust SheetName and Column number
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-11-2013
    Location
    Portgal
    MS-Off Ver
    Excel 2016
    Posts
    47

    Re: Send Email using Gmail to multiple "clients"

    bakerman2 thank you very much...... I could not test you solution yet, but tomorrow Iīll try it for sure......

    Again, many thanks.....

  6. #6
    Registered User
    Join Date
    11-11-2013
    Location
    Portgal
    MS-Off Ver
    Excel 2016
    Posts
    47

    Re: Send Email using Gmail to multiple "clients"

    Hello again.... Need help to change a little thing in the first code I wrote...

    If you see, the code mail a specific pdf file.... What I need is that the code mail files of that kind of file (pdf).... Because if I change the name of the file, it won't send the file...

    Can you help me on this???

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Send Email using Gmail to multiple "clients"

    You haven't explained how the macro is supposed to know what file to send? Will it always be whatever PDF is in a specific folder? If you change the PDF in that folder, send the new one instead? If there are multiple PDFs, should it send them all?

    This line of code is doing your current "attaching":
    Please Login or Register  to view this content.
    Maybe this would work for a single file:
    Please Login or Register  to view this content.
    You would need a loop to find multiple files:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    11-11-2013
    Location
    Portgal
    MS-Off Ver
    Excel 2016
    Posts
    47

    Re: Send Email using Gmail to multiple "clients"

    Jbeaucaire thanks for your help....

    I want to send one pdf file despite the name.... I can only have one pdf file in the folder....

    So, I'll put *.pdf in the code... It will send the file, whatever his name....

  9. #9
    Registered User
    Join Date
    11-11-2013
    Location
    Portgal
    MS-Off Ver
    Excel 2016
    Posts
    47

    Re: Send Email using Gmail to multiple "clients"

    bakerman2 - your solution for multiple mail clients works very well.... Many thanks.....

    Jbeaucaire - your solution also works great.... Again many thanks.....


    I have two more little issues to put this work like a charm....


    First - Now I can create a pdf file and send it to multiple clients automatically..... I try it with my mails and work just fine, but the mails went to the spam box.... Do you know why is that???

    The attached file is just a simple pdf file... No virus or malware goes with it....


    Second - Another "problem" is when I create the pdf file..... This is part of the code:

    Please Login or Register  to view this content.
    How can I add the value of a cell into the file name???

    What I need is save the file like this (FixedFilePathName:="C:\Users\Desktop\xpto + value of the cell A1.pdf")..... In my case the cell value is a date "=today()+1"

    Example: C:\Users\Desktop\xpto_01/08/2015.pdf


    Can I fix this 2 "problems" easily??? Thank you for any help you can give and most important thank you for your patience......

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Send Email using Gmail to multiple "clients"

    When inserting dates into filenames, you can't use / or \, so always use "-"
    Please Login or Register  to view this content.
    People will need to set your emails and attachments as "safe" in their spam controls.

  11. #11
    Registered User
    Join Date
    11-11-2013
    Location
    Portgal
    MS-Off Ver
    Excel 2016
    Posts
    47

    Re: Send Email using Gmail to multiple "clients"

    JBeaucaire, I put your solution about the filename (FixedFilePathName:="C:\Users\Desktop\xpto_" & Format(Date + 1, "MM-DD-YY") & ".pdf") and it works......

    But the other suggestion you made earlier about the saving pdf file doesnīt work (objEmail.AddAttachment "C:\Users\123\Desktop\*.pdf")

    Run-Time error '-2147024773 (8007007b)':
    The filename, directory name, or volume label syntax is incorrect.


    I already try to put commas (" * ".pdf), but donīt work either.....

  12. #12
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Send Email using Gmail to multiple "clients"

    Use the last suggestion that included the pdfNAME in a variable.

  13. #13
    Registered User
    Join Date
    11-11-2013
    Location
    Portgal
    MS-Off Ver
    Excel 2016
    Posts
    47

    Re: Send Email using Gmail to multiple "clients"

    JBeaucaire, I try your last suggestion but donīt either.....

    I found a code that already put on road and works....

    Please Login or Register  to view this content.

    Again, thank you very much for your attention on this.....

  14. #14
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Send Email using Gmail to multiple "clients"

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Send Email when I press "Send" button in Outlook
    By qzqzjcjp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-27-2015, 09:37 AM
  2. Replies: 0
    Last Post: 04-17-2015, 06:01 AM
  3. Send email through excel using gmail to multiple recipents
    By Neha3587 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-31-2014, 09:04 AM
  4. Macro to open mailto hyperlink in excel, then click on "Send" in gmail
    By beepbeep27 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-30-2012, 11:10 AM
  5. Replies: 5
    Last Post: 09-19-2008, 04:02 PM

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1