Results 1 to 5 of 5

Thread: [Excel/Access VBA] How to send email.... With a difference

  1. #1

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    [Excel/Access VBA] How to send email.... With a difference

    Hiya,

    I am used to sending emails via Outlook. Outlook express refuses, but since that is not an internal problem...


    However, rumours have been going around that the main core email is being shifted from MS Outlook and exchange to Google Apps. Presumably the gmail is included in that.

    Brilliant, in that I could log in from around the world and send an email/deal with questions.

    Then the secondary thought hit home. What happens to all the VBA Excel and Access coding that sends emails?

    With no outlook (at least likely to be none) how would it tell gmal / google apps to send an email?


    I was wondering if anyone has done this or has links online to information on how to do this.

    Main problems are:
    I don't know when the transfer is going to be and
    I dont have it installed (assuming an installation of some sort is required) yet.

    Any pointers appreciated

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [Excel/Access VBA] How to send email.... With a difference

    i have successfully sent email via gmail, using cdo.message,

    vb Code:
    1. Set objmessage = CreateObject("CDO.Message")
    2.       objmessage.Subject = "Example CDO Message"
    3.       objmessage.From = "me@my.com"
    4.       objmessage.To = "me" ' sent to myself, not at gmail
    5.       objmessage.TextBody = "This is some sample message text."
    6.        
    7.        objmessage.Configuration.Fields.Item _
    8.       ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    9.        
    10.       'Name or IP of Remote SMTP Server
    11.        
    12.        
    13.       'Type of authentication, NONE, Basic (Base64 encoded), NTLM
    14.       objmessage.Configuration.Fields.Item _
    15.       ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    16.       'Your UserID on the SMTP server
    17.       objmessage.Configuration.Fields.Item _
    18.       ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "usernm"
    19.        
    20.       'Your password on the SMTP server
    21.        
    22.       objmessage.Configuration.Fields.Item _
    23.       ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "pass"
    24.       objmessage.Configuration.Fields.Item _
    25.       ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
    26.       'Server port (typically 25)
    27.       objmessage.Configuration.Fields.Item _
    28.       ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
    29.       'Use SSL for the connection (False or True)
    30.       objmessage.Configuration.Fields.Item _
    31.       ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
    32.       'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
    33.       objmessage.Configuration.Fields.Item _
    34.       ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
    35.       objmessage.Configuration.Fields.Update
    36.       objmessage.Send
    37.       Set objmessage = Nothing
    gmail will not allow spoofing of sender name
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: [Excel/Access VBA] How to send email.... With a difference

    thanks

    Will try if it comes in.

    Alternative is that the Outlook will need to be configured to talk to the Google apps and if this is the case, I wont / shouldnt need to change much if anything...

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [Excel/Access VBA] How to send email.... With a difference

    i believe there is restrictions on the type of attachments that can be sent by gmail

    no exes and someothers
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: [Excel/Access VBA] How to send email.... With a difference

    No problem - got those restrictions at the moment too

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

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



Click Here to Expand Forum to Full Width