SMTPSendMail: Edit Before Sending?
Moderators: Dorian (MJT support), JRL
SMTPSendMail: Edit Before Sending?
I am working on a distribution tool but the addresses of the people receiving the distribution need to be dynamic. Is it possible to use SMTPSendMail to generate the email but allow the user to edit it before sending? I would simply create an Input but I want users to be able to have the full functionality of Outlook when selecting email addresses.
Thanks,
Josh
Josh
Do you mean you want the users to have access to the contact list stored in Outlook? This is possible, but more work.
Or just similar functionality?
Similar functionality can be built using a custom dialog, (and if you want to get fancy) you can even store a contact list using (you pick the method.... text file, ini file, database, registry entries, even Outlook's store)
Then the SMTPSendMail command uses the text and addresses you have preselected for it to use.
Or just similar functionality?
Similar functionality can be built using a custom dialog, (and if you want to get fancy) you can even store a contact list using (you pick the method.... text file, ini file, database, registry entries, even Outlook's store)
Then the SMTPSendMail command uses the text and addresses you have preselected for it to use.
In MS Access, when you use SendObject, you can select whether you want Access to send the email immediately or you can edit the email before it's sent. If you pick the edit feature, Access generates the email and leaves it open, as though you had created it yourself using only Outlook. Ideally, that's all I want to do, generate the email but then leave it open on the screen.
Thanks,
Josh
Josh
This is not 100% finished - for one thing it only sends the email to the 1st address given, but it DOES work and send the emails. Should give you ideas, and a good sample to start from. I only have Macro Scheduler version 10 so I don't have any of the fancy new Dialog features in version 12. You might be able to make it even more spiffy.
Be sure to change the smtp variable to point to your SMTP server
Be sure to change the smtp variable to point to your SMTP server
Code: Select all
Dialog>Dialog1
Caption=Custom Email Send
Width=771
Height=624
Top=116
Left=70
Max=1
Min=1
Close=1
Resize=1
Memo=msEmailBody,32,176,697,345,EmailBodyText
Edit=msSubject,96,136,633,EmailSubject
Label=Subject:,32,136,true
Memo=msFrom,96,16,633,25,EmailFrom
Label=From:,48,24,true
Memo=msTo1,96,48,633,25,
ComboBox=msToCombo1,24,48,65,To:%CRLF%CC:
ComboBox=msToCombo2,24,72,65,To:%CRLF%CC:%CRLF%BCC
ComboBox=msToCombo3,24,96,65,To:%CRLF%CC:%CRLF%BCC
Memo=msTo2,96,72,633,25,
Memo=msTo3,96,96,633,25,
Button=Send,40,536,75,25,3
Button=Cancel,136,536,75,25,2
EndDialog>Dialog1
//Get the current date to put in email
GetDate>myDate
Let>EmailBodyText=1234, Main Street%CRLF%Boston, MA 02123%CRLF%%myDate%%CRLF%%CRLF%Hello.%CRLF%%CRLF%I recently purchased a TV from your company and I thought I should write and let you know how pleased I am with it.%CRLF%%CRLF%In an age when so many products don't live up to their advertising claims, your TV does everything you say it does. I am one satisfied customer, and will continue to be for years to come.%CRLF%%CRLF%Thank you for your time.%CRLF%%CRLF%Sincerely,%CRLF%%CRLF%John Doe
Let>EmailSubject=Thank you - I am a happy customer
Let>[email protected]
Let>smtp=192.168.3.3
Let>attach=
Let>SMTP_TIMEOUT=20000
//Only use the following lines if your server requires authentication
//Let>SMTP_AUTH=1
//Let>[email protected]
//Let>SMTP_PASSWORD=yyyyyyy
Label>MainLoop
Show>Dialog1,result
If>result=2
Goto>End
Endif
If>result=3
Gosub>SendMail
Goto>End
Endif
Wait>0.5
Goto>MainLoop
SRT>SendMail
SMTPSendMail>Dialog1.msTo1,smtp,Dialog1.msFrom,Dialog1.msFrom,Dialog1.msSubject,Dialog1.msEmailBody,attach
//Use the following line for picky smtp servers
//SMTPSendMail>Dialog1.msTo1,smtp,Dialog1.msFrom,%SPACE%,Dialog1.msSubject,Dialog1.msEmailBody,attach
MessageModal>SMTP_RESULT
END>SendMail
Label>End