No announcement yet.

gbSendMail - Send Emails (Discussion)

  • Filter
  • Time
  • Show
Clear All
new posts

  • #21
    But, , if I were going to have a GoDo list:

    1. Binary attachments
    2. Multiple To: address
    3. BC/CC
    4. Support for HTML and plain text bodies
    5. Consistency/broader support for various formats ... "John <[email protected]>", etc.

    I know that some of these are already supported by the original author's code. I just didn't have my scope for gbSendMail set that wide.

    So if you want to add one of those features, you can check the original author's code to see if it's already available.


    • #22
      1) Binary attachments are fairly straightforward, they're usually just base64 encoded -- one of the very first PB SMTP demos (i think in \pb\samples\) shows how to do this

      2) Multiple to: address
      This is also related to 3) (BCC/CC)
      Basically, to send to multiple addresses you simply send "RCPT TO <nextemailaddress>" over and over for each address - you should receive a 250 "success" error code for each valid email address. The resulting email by default is a BCC. If you want to make it a CC (so that ppl can see who else you've sent it to), you simply include the CC field in the email header (alongside the To, From, Subject, Date, X-Mailer etc etc header fields).

      4) Support for HTML is kinda easy enough...
      Here is a "PLAINTEXT HTML-based" email, that simply says "Hello world"... (note - plaintext, but still with a specified formatting ... with plaintext though you dont actually need to specify these fields like 'Content-Type')
      Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original
      Content-Transfer-Encoding: 7bit
      Hello world
      HTML formatted (you'll notice it first has the "plaintext" version, then the HTML version):
      Content-Type: multipart/alternative;
      This is a multi-part message in MIME format.
      Content-Type: text/plain;
      Content-Transfer-Encoding: quoted-printable
      Hello world
      Content-Type: text/html;
      Content-Transfer-Encoding: quoted-printable
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
      <META http-equiv=3DContent-Type content=3D"text/html; =
      <META content=3D"MSHTML 6.00.2900.5512" name=3DGENERATOR>
      <BODY bgColor=3D#ffffff>
      <DIV><FONT face=3DArial size=3D2>Hello world</FONT></DIV></BODY></HTML>
      Some of these are pretty "raw/native" features though so while they're fairly straight-forward with pure TCP I'm not sure how to accomplish these differences if using say, CDO for example, unless it has some option to support these, although Jose posted a list of about 30 or so options/parameters for that so who knows! HTML email is so common though so im sure there'd be some way, and I know just the man who'd know
      Last edited by Wayne Diamond; 8 Aug 2014, 07:54 AM.


      • #23
        > I'm not sure how to accomplish these differences if using say, CDO for example, unless it has some option to support these,

        Instead of pMessage.TextBody, use pMessage.HtmlBody.


        • #24
          Originally posted by Wayne Diamond View Post
          and I know just the man who'd know
          ... *tops up Jose's drink!*
          I love your work mate, have a great weekend!


          • #25
            Documentation of the IMessage interface:


            IMessage Interface
            Attachments Property
            AutoGenerateTextBody Property
            BCC Property
            BodyPart Property
            CC Property
            Configuration Property
            DataSource Property
            DSNOptions Property
            EnvelopeFields Property
            Fields Property
            FollowUpTo Property
            From Property
            HTMLBody Property
            HTMLBodyPart Property
            Keywords Property
            MDNRequested Property
            MimeFormatted Property
            Newsgroups Property
            Organization Property
            ReceivedTime Property
            ReplyTo Property
            Sender Property
            SentOn Property
            Subject Property
            TextBody Property
            TextBodypart Property
            To Property
            AddAttachment Method
            AddRelatedBodyPart Method
            CreateMHTMLBody Method
            Forward Method
            GetInterface Method
            GetStream Method
            Post Method
            PostReply Method
            Reply Method
            ReplyAll Method
            Send Method
            Last edited by José Roca; 8 Aug 2014, 11:12 AM.


            • #26
              To note... Many servers throttle traffic to save cost (they may say to increase security). Personally, I send messages in batches of no more than 5 ("to" addresses and/or separate messages) without disconnecting, waiting a second or two, then reconnecting and continuing. This seems to keep the sending server from getting "annoyed". Many servers allow 10 with no issues, but in the "wild", I never know what servers my customers will use, so I use 5 to be safer.


              • #27
                Hi Gary,

                Am I wrong or the email "From" and "To" are swapped?

                Last edited by Manuel Valdes; 8 Aug 2014, 05:42 PM.


                • #28
                  Hi Manuel,

                  The "From" seems to sync up when I send myself an email.

                  I've got to leave for a little while, but will do some more checking when I get back.

                  Which gbSendMail settings were you using? Can you send me an image of what you used (no password, of course!).


                  • #29
                    Thanks so much for the catch. Here's what I had done wrong (in the new Squires class code method) ...
                       cMail.SendFrom     = sTo
                       cMail.SendTo       = sFrom
                    The fixe has been uploaded (v1.21)


                    • #30
                      Hi Gary,

                      Sorry for not answering in time. I tested it in my job office and then left to home. Many thanks for your nice work putting that code together, really useful. And many thanks for all your support to these forums.

                      Best regards,
                      Last edited by Manuel Valdes; 8 Aug 2014, 10:07 PM.


                      • #31
                        Nice Job

                        Nice job, guys!
                        How I can request a reading recept when sending a mail?


                        • #32
                          Hi Emanuele!
                          Sorry, but I don't know the answer myself. Perhaps someone will chime in here shortly ...


                          • #33
                            Googling "mailer.ConfirmRead" and "mailer.ConfirmReceipt" may get you started...



                            • #34
                              Email program

                              This looks cool...
                              Last edited by Jim Seekamp; 17 Aug 2015, 02:59 PM.
                              Jim Seekamp


                              • #35
                                The only one I can get to work with GMAIL is Jose Roca's using port 465 and checking authentication and SSL in settings.
                                I don't think the others have the option to use both authenticate and encrypt in the settings.

                                GMail doesn't work here without lowering security settings

                                Is there a way to get Jose Roca's (or one of the others) to work without lowering security using GMail?




                                Found this link Authorizing Your App with Gmail

                                Keeps getting better

                                Created an OAuth 2.0 client ID and password using
                       under Creditials

                                Trying to figure out how to present the the ID to the Google SMTP Server.
                                I think once this is done Google will recognize the machine and security won't need to be reduced.
                                If anyone has done this, please advise.
                                Last edited by Mike Doty; 11 Nov 2017, 06:00 PM.
                                CMD shortcut to open any location:
                                %windir%\system32\cmd.exe /k " cd\ & x: & cd x:\xxxx
                                Change to run as administrator
                                How long is an idea? Write it down.


                                • #36
                                  Where do i get the 2 INC files from
                                  Ian Docksey, Trinitarian Bible Society


                                  • #37
                                    Just a wild guess here... Are you missing CDOSYS.INC and OLE2UTILS.INC? If so, install Jose' Roca includes.