Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
sending emails using REALbasic
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Hime" data-source="post: 1215623" data-attributes="member: 197700"><p>Hi,</p><p></p><p>I have started using a MacBook a couple of weeks ago at my new job and I'm still getting used to it.</p><p>This is my first experience using a apple product and I'm finding it awesome <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p><p></p><p>Now, about my problem:</p><p>I need to send hundred of emails per day and I'm wasting most of my time doing copy-paste from a excel file to a new e-mail.</p><p>I created templates for every type of e-mail I need to send, but some of the information have to change depending on the client, eg. clients name, email address, hotel...</p><p></p><p>I really don't know how to do it... I was thinking in creating a macro.... and indeed I tried... but let's be honest I can barely program VB how can I do it with RB??</p><p></p><p>Well, any help or idea would be appreciated.</p><p></p><p>This is what I have so far.... (macro using VB language):</p><p></p><p>Sub SendEMail()</p><p> Dim Email As String, Subj As String</p><p> Dim Msg As String, URL As String</p><p> Dim r As Integer, x As Double</p><p> For r = 2 To 3 'data in rows 2-3</p><p>' Get the email address</p><p> Email = Cells(r, 2)</p><p> </p><p>' Message subject</p><p> Subj = "CompanyX Login Information"</p><p></p><p>' Compose the message</p><p> Msg = ""</p><p> Msg = Msg & "Dear " & Cells(r, 1) & "," & vbCrLf & vbCrLf</p><p> Msg = Msg & "I am pleased to inform you that ..."</p><p> Msg = Msg & Cells(r, 3).Text & "." & vbCrLf & vbCrLf</p><p> Msg = Msg & "Thank you" & vbCrLf</p><p> Msg = Msg & "Best Regards," & vbCrLf</p><p> Msg = Msg & "Meee"</p><p> </p><p>' Replace spaces with %20 (hex)</p><p> Subj = Application.WorksheetFunction.Substitute(Subj, " ", "%20")</p><p> Msg = Application.WorksheetFunction.Substitute(Msg, " ", "%20")</p><p> </p><p>' Replace carriage returns with %0D%0A (hex)</p><p> Msg = Application.WorksheetFunction.Substitute(Msg, vbCrLf, "%0D%0A") </p><p></p><p>' Create the URL</p><p> URL = "mailto:" & Email & "?subject=" & Subj & "&body=" & Msg </p><p></p><p>' Execute the URL (start the email client)</p><p> ShellExecute 0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus</p><p></p><p>' Wait two seconds before sending keystrokes</p><p> Application.Wait (Now + TimeValue("0:00:02"))</p><p> Application.SendKeys "%s"</p><p> Next r</p><p>End Sub</p><p></p><p>Of course I get an error when trying to run it on my new MAC :/</p><p></p><p>Thanks a lot,</p><p>VT</p></blockquote><p></p>
[QUOTE="Hime, post: 1215623, member: 197700"] Hi, I have started using a MacBook a couple of weeks ago at my new job and I'm still getting used to it. This is my first experience using a apple product and I'm finding it awesome :) Now, about my problem: I need to send hundred of emails per day and I'm wasting most of my time doing copy-paste from a excel file to a new e-mail. I created templates for every type of e-mail I need to send, but some of the information have to change depending on the client, eg. clients name, email address, hotel... I really don't know how to do it... I was thinking in creating a macro.... and indeed I tried... but let's be honest I can barely program VB how can I do it with RB?? Well, any help or idea would be appreciated. This is what I have so far.... (macro using VB language): Sub SendEMail() Dim Email As String, Subj As String Dim Msg As String, URL As String Dim r As Integer, x As Double For r = 2 To 3 'data in rows 2-3 ' Get the email address Email = Cells(r, 2) ' Message subject Subj = "CompanyX Login Information" ' Compose the message Msg = "" Msg = Msg & "Dear " & Cells(r, 1) & "," & vbCrLf & vbCrLf Msg = Msg & "I am pleased to inform you that ..." Msg = Msg & Cells(r, 3).Text & "." & vbCrLf & vbCrLf Msg = Msg & "Thank you" & vbCrLf Msg = Msg & "Best Regards," & vbCrLf Msg = Msg & "Meee" ' Replace spaces with %20 (hex) Subj = Application.WorksheetFunction.Substitute(Subj, " ", "%20") Msg = Application.WorksheetFunction.Substitute(Msg, " ", "%20") ' Replace carriage returns with %0D%0A (hex) Msg = Application.WorksheetFunction.Substitute(Msg, vbCrLf, "%0D%0A") ' Create the URL URL = "mailto:" & Email & "?subject=" & Subj & "&body=" & Msg ' Execute the URL (start the email client) ShellExecute 0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus ' Wait two seconds before sending keystrokes Application.Wait (Now + TimeValue("0:00:02")) Application.SendKeys "%s" Next r End Sub Of course I get an error when trying to run it on my new MAC :/ Thanks a lot, VT [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
sending emails using REALbasic
Top