Results 1 to 6 of 6
  1. #1
    fletcjas is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2018
    Location
    Lincoln, UK
    Posts
    23

    Sending custom text in email

    Hello,
    I am running the following code:

    Code:
    Set emailObj = CreateObject("CDO.Message")
    
    
    emailObj.From = "FROM EMAIL ADRESS"
    emailObj.To = Me.EmailAddress.Value
    
    
    'emailObj.To = "TO EMAIL ADDRESS"
    emailObj.Subject = "Portal Account Reset"
    emailObj.TextBody = "CUSTOM TEXT HERE"
    Set emailConfig = emailObj.Configuration
    
    
    emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "SERVER"
    'Exclude the following line
    'emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = "25"
    emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "EMAIL ADDRESS"
    emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "EMAIL PASSWORD"
    emailConfig.Fields.Update
    
    
    emailObj.Send
    I am looking to have the text say something like:
    Code:
    "Hello " & Me.FirstName.Value & ", Your login information has been reset." & "" & Chr(13) & Chr(10) & "The security questions have been removed, and your new password is:" & Me.Password.Value & " "- Please use this at next logon, Web address: https://SERVER" & "" & Chr(13) & Chr(10) & "If this was not requested, please contact a member of the team" & "" & Chr(13) & Chr(10) & "HBK Karate & "" & Chr(13) & Chr(10) & " https://SERVER"
    I am looking for it to be formatted like this:

    Hello NAME,
    Your portal login information has been modified,
    the security questions and password have been reset.

    Your new password is: PASSWORD

    Please login and change your password via https://SERVER.

    If the account modification was not requested, please contact a member of the team.

    regards
    team
    email@server
    https://server
    What am i doing wrong,



    Thanks

    Jason

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    To get the bold you'd need to use HTML in the body. It looks like it's covered here:

    https://www.rondebruin.nl/win/s1/cdo.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    fletcjas is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2018
    Location
    Lincoln, UK
    Posts
    23
    Quote Originally Posted by pbaldy View Post
    To get the bold you'd need to use HTML in the body. It looks like it's covered here:

    https://www.rondebruin.nl/win/s1/cdo.htm
    Hey,

    The bold shows where the text is pulled in from the database, I'm not worried about these being bold - Should have said that in the original thread.

    Thanks

    Jase

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Oh, you're on the right track then. I'd use a variable:

    stBody = "Hello " & Me.FirstName.Value & ", Your..."

    and then

    emailObj.TextBody = strBody

    That makes it easier to debug the string.

    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    fletcjas is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2018
    Location
    Lincoln, UK
    Posts
    23
    Thanks for the reply. I had added extra speech marks where not required! This has been resolved! thanks for your help.. I should have spotted it.. Long day!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Ah good, glad you got it sorted. Sorry, I had only looked at the first bit of the string.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 11-07-2016, 11:18 AM
  2. Replies: 1
    Last Post: 07-01-2015, 04:18 AM
  3. Replies: 3
    Last Post: 02-23-2015, 02:13 PM
  4. Replies: 1
    Last Post: 05-06-2014, 09:14 PM
  5. Email sending
    By Steven.Allman in forum Access
    Replies: 25
    Last Post: 06-21-2010, 09:37 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums