Open email window to allow physical input
I want the user to be able to manually complete an email in an actual instance of Outlook as opposed to hard-coding the values or input in the shell.
import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = '***'
mail.Subject = '***'
mail.Body = '***'
mail.Send()
python outlook
add a comment |
I want the user to be able to manually complete an email in an actual instance of Outlook as opposed to hard-coding the values or input in the shell.
import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = '***'
mail.Subject = '***'
mail.Body = '***'
mail.Send()
python outlook
add a comment |
I want the user to be able to manually complete an email in an actual instance of Outlook as opposed to hard-coding the values or input in the shell.
import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = '***'
mail.Subject = '***'
mail.Body = '***'
mail.Send()
python outlook
I want the user to be able to manually complete an email in an actual instance of Outlook as opposed to hard-coding the values or input in the shell.
import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = '***'
mail.Subject = '***'
mail.Body = '***'
mail.Send()
python outlook
python outlook
edited Feb 15 at 18:28
visualnotsobasic
asked Nov 15 '18 at 20:55
visualnotsobasicvisualnotsobasic
579
579
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Do not call mail.Send()
- call mail.Display(true)
to display the message modally.
add a comment |
The input()
built-in. Example:
import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = input("Mail to: ")
mail.Subject = input("Mail Subject: ")
mail.Body = input("Mail Body: ")
attachment = str(output_file)
attachpath = "my_attachment_path"
attachfull = attachpath+attachment
attachf = str(attachfull)
mail.Attachments.Add(Source=attachf)
mail.Send()
Wonderful - is there any way to make it pop up in a box vs the shell without having to create something complex? My listbox with tkinter took me much longer than it should have haha.
– visualnotsobasic
Nov 15 '18 at 21:05
tkinter is really your best way to go. There are some hacky ways to do it but you're better off just learning tkinter for the simple stuff like this. It gets easier
– krflol
Nov 15 '18 at 21:12
thanks - last question if i may, then i'll mark it as answered. is there a way to open the physical mail message with the attachment attached and then just let the user do the rest manually?
– visualnotsobasic
Nov 15 '18 at 21:29
I didn't go too deep down the outlook.application rabbit hole, but I would be willing to be that it is definitely doable. docs.microsoft.com/en-us/office/vba/outlook/concepts/… exampleSub CreateAnotherNewDefaultOutlookTask() Dim NewTask As Outlook.TaskItem ' You can only use CreateItem for default items Set NewTask = Application.CreateItem(olTaskItem) ' Display the new task form so the user can fill it out NewTask.Display End Sub
– krflol
Nov 15 '18 at 21:35
turns out if we just change mail.send() to mail.Display(True) it adds the attachment and then opens the email to be finished!
– visualnotsobasic
Nov 15 '18 at 21:59
|
show 1 more comment
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53327773%2fopen-email-window-to-allow-physical-input%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Do not call mail.Send()
- call mail.Display(true)
to display the message modally.
add a comment |
Do not call mail.Send()
- call mail.Display(true)
to display the message modally.
add a comment |
Do not call mail.Send()
- call mail.Display(true)
to display the message modally.
Do not call mail.Send()
- call mail.Display(true)
to display the message modally.
answered Nov 15 '18 at 22:02
Dmitry StreblechenkoDmitry Streblechenko
44k32860
44k32860
add a comment |
add a comment |
The input()
built-in. Example:
import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = input("Mail to: ")
mail.Subject = input("Mail Subject: ")
mail.Body = input("Mail Body: ")
attachment = str(output_file)
attachpath = "my_attachment_path"
attachfull = attachpath+attachment
attachf = str(attachfull)
mail.Attachments.Add(Source=attachf)
mail.Send()
Wonderful - is there any way to make it pop up in a box vs the shell without having to create something complex? My listbox with tkinter took me much longer than it should have haha.
– visualnotsobasic
Nov 15 '18 at 21:05
tkinter is really your best way to go. There are some hacky ways to do it but you're better off just learning tkinter for the simple stuff like this. It gets easier
– krflol
Nov 15 '18 at 21:12
thanks - last question if i may, then i'll mark it as answered. is there a way to open the physical mail message with the attachment attached and then just let the user do the rest manually?
– visualnotsobasic
Nov 15 '18 at 21:29
I didn't go too deep down the outlook.application rabbit hole, but I would be willing to be that it is definitely doable. docs.microsoft.com/en-us/office/vba/outlook/concepts/… exampleSub CreateAnotherNewDefaultOutlookTask() Dim NewTask As Outlook.TaskItem ' You can only use CreateItem for default items Set NewTask = Application.CreateItem(olTaskItem) ' Display the new task form so the user can fill it out NewTask.Display End Sub
– krflol
Nov 15 '18 at 21:35
turns out if we just change mail.send() to mail.Display(True) it adds the attachment and then opens the email to be finished!
– visualnotsobasic
Nov 15 '18 at 21:59
|
show 1 more comment
The input()
built-in. Example:
import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = input("Mail to: ")
mail.Subject = input("Mail Subject: ")
mail.Body = input("Mail Body: ")
attachment = str(output_file)
attachpath = "my_attachment_path"
attachfull = attachpath+attachment
attachf = str(attachfull)
mail.Attachments.Add(Source=attachf)
mail.Send()
Wonderful - is there any way to make it pop up in a box vs the shell without having to create something complex? My listbox with tkinter took me much longer than it should have haha.
– visualnotsobasic
Nov 15 '18 at 21:05
tkinter is really your best way to go. There are some hacky ways to do it but you're better off just learning tkinter for the simple stuff like this. It gets easier
– krflol
Nov 15 '18 at 21:12
thanks - last question if i may, then i'll mark it as answered. is there a way to open the physical mail message with the attachment attached and then just let the user do the rest manually?
– visualnotsobasic
Nov 15 '18 at 21:29
I didn't go too deep down the outlook.application rabbit hole, but I would be willing to be that it is definitely doable. docs.microsoft.com/en-us/office/vba/outlook/concepts/… exampleSub CreateAnotherNewDefaultOutlookTask() Dim NewTask As Outlook.TaskItem ' You can only use CreateItem for default items Set NewTask = Application.CreateItem(olTaskItem) ' Display the new task form so the user can fill it out NewTask.Display End Sub
– krflol
Nov 15 '18 at 21:35
turns out if we just change mail.send() to mail.Display(True) it adds the attachment and then opens the email to be finished!
– visualnotsobasic
Nov 15 '18 at 21:59
|
show 1 more comment
The input()
built-in. Example:
import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = input("Mail to: ")
mail.Subject = input("Mail Subject: ")
mail.Body = input("Mail Body: ")
attachment = str(output_file)
attachpath = "my_attachment_path"
attachfull = attachpath+attachment
attachf = str(attachfull)
mail.Attachments.Add(Source=attachf)
mail.Send()
The input()
built-in. Example:
import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = input("Mail to: ")
mail.Subject = input("Mail Subject: ")
mail.Body = input("Mail Body: ")
attachment = str(output_file)
attachpath = "my_attachment_path"
attachfull = attachpath+attachment
attachf = str(attachfull)
mail.Attachments.Add(Source=attachf)
mail.Send()
answered Nov 15 '18 at 20:59
krflolkrflol
53728
53728
Wonderful - is there any way to make it pop up in a box vs the shell without having to create something complex? My listbox with tkinter took me much longer than it should have haha.
– visualnotsobasic
Nov 15 '18 at 21:05
tkinter is really your best way to go. There are some hacky ways to do it but you're better off just learning tkinter for the simple stuff like this. It gets easier
– krflol
Nov 15 '18 at 21:12
thanks - last question if i may, then i'll mark it as answered. is there a way to open the physical mail message with the attachment attached and then just let the user do the rest manually?
– visualnotsobasic
Nov 15 '18 at 21:29
I didn't go too deep down the outlook.application rabbit hole, but I would be willing to be that it is definitely doable. docs.microsoft.com/en-us/office/vba/outlook/concepts/… exampleSub CreateAnotherNewDefaultOutlookTask() Dim NewTask As Outlook.TaskItem ' You can only use CreateItem for default items Set NewTask = Application.CreateItem(olTaskItem) ' Display the new task form so the user can fill it out NewTask.Display End Sub
– krflol
Nov 15 '18 at 21:35
turns out if we just change mail.send() to mail.Display(True) it adds the attachment and then opens the email to be finished!
– visualnotsobasic
Nov 15 '18 at 21:59
|
show 1 more comment
Wonderful - is there any way to make it pop up in a box vs the shell without having to create something complex? My listbox with tkinter took me much longer than it should have haha.
– visualnotsobasic
Nov 15 '18 at 21:05
tkinter is really your best way to go. There are some hacky ways to do it but you're better off just learning tkinter for the simple stuff like this. It gets easier
– krflol
Nov 15 '18 at 21:12
thanks - last question if i may, then i'll mark it as answered. is there a way to open the physical mail message with the attachment attached and then just let the user do the rest manually?
– visualnotsobasic
Nov 15 '18 at 21:29
I didn't go too deep down the outlook.application rabbit hole, but I would be willing to be that it is definitely doable. docs.microsoft.com/en-us/office/vba/outlook/concepts/… exampleSub CreateAnotherNewDefaultOutlookTask() Dim NewTask As Outlook.TaskItem ' You can only use CreateItem for default items Set NewTask = Application.CreateItem(olTaskItem) ' Display the new task form so the user can fill it out NewTask.Display End Sub
– krflol
Nov 15 '18 at 21:35
turns out if we just change mail.send() to mail.Display(True) it adds the attachment and then opens the email to be finished!
– visualnotsobasic
Nov 15 '18 at 21:59
Wonderful - is there any way to make it pop up in a box vs the shell without having to create something complex? My listbox with tkinter took me much longer than it should have haha.
– visualnotsobasic
Nov 15 '18 at 21:05
Wonderful - is there any way to make it pop up in a box vs the shell without having to create something complex? My listbox with tkinter took me much longer than it should have haha.
– visualnotsobasic
Nov 15 '18 at 21:05
tkinter is really your best way to go. There are some hacky ways to do it but you're better off just learning tkinter for the simple stuff like this. It gets easier
– krflol
Nov 15 '18 at 21:12
tkinter is really your best way to go. There are some hacky ways to do it but you're better off just learning tkinter for the simple stuff like this. It gets easier
– krflol
Nov 15 '18 at 21:12
thanks - last question if i may, then i'll mark it as answered. is there a way to open the physical mail message with the attachment attached and then just let the user do the rest manually?
– visualnotsobasic
Nov 15 '18 at 21:29
thanks - last question if i may, then i'll mark it as answered. is there a way to open the physical mail message with the attachment attached and then just let the user do the rest manually?
– visualnotsobasic
Nov 15 '18 at 21:29
I didn't go too deep down the outlook.application rabbit hole, but I would be willing to be that it is definitely doable. docs.microsoft.com/en-us/office/vba/outlook/concepts/… example
Sub CreateAnotherNewDefaultOutlookTask() Dim NewTask As Outlook.TaskItem ' You can only use CreateItem for default items Set NewTask = Application.CreateItem(olTaskItem) ' Display the new task form so the user can fill it out NewTask.Display End Sub
– krflol
Nov 15 '18 at 21:35
I didn't go too deep down the outlook.application rabbit hole, but I would be willing to be that it is definitely doable. docs.microsoft.com/en-us/office/vba/outlook/concepts/… example
Sub CreateAnotherNewDefaultOutlookTask() Dim NewTask As Outlook.TaskItem ' You can only use CreateItem for default items Set NewTask = Application.CreateItem(olTaskItem) ' Display the new task form so the user can fill it out NewTask.Display End Sub
– krflol
Nov 15 '18 at 21:35
turns out if we just change mail.send() to mail.Display(True) it adds the attachment and then opens the email to be finished!
– visualnotsobasic
Nov 15 '18 at 21:59
turns out if we just change mail.send() to mail.Display(True) it adds the attachment and then opens the email to be finished!
– visualnotsobasic
Nov 15 '18 at 21:59
|
show 1 more comment
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53327773%2fopen-email-window-to-allow-physical-input%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown