Reply email powershell
Hi again StackOverflow's comunity, I will ask about method ".reply()". This is the code I am trying:
function Unread ($correo) {
if(($correo -eq $null) -or ($correo.Unread.ToString() -like "False")){
$Noleido = $false
}else{
$Noleido = $true
return $Noleido
}
}
$body = "Bla bla bla"
$firma = "I am here"
#$cuerpo = "A test ps"
$subject = "Re: automated reply"
$Outlook = New-Object -comObject Outlook.Application
$OutlookFolders = $Outlook.Session.Folders.Item($buzon1).Folders
#Map la bandeja de entrada.
$bandeja_de_entrada=$OutlookFolders.Item("INBOX_FOLDER")
#Creamos el objeto que hace referencia a la bandeja de entrada y los mensajes que contiene.
$all_mail=$bandeja_de_entrada.Items
foreach ($mail in $all_mail){
$flag1 = Unread($mail)
if($flag1 -eq $true){
#$mail.to = ""
$mail.body =" $cuerpo" +"$firma"
$mail.subject = $subject
$mail.reply()
}
}
Dont send the email.
Its solved in a answer
powershell email outlook automation reply
add a comment |
Hi again StackOverflow's comunity, I will ask about method ".reply()". This is the code I am trying:
function Unread ($correo) {
if(($correo -eq $null) -or ($correo.Unread.ToString() -like "False")){
$Noleido = $false
}else{
$Noleido = $true
return $Noleido
}
}
$body = "Bla bla bla"
$firma = "I am here"
#$cuerpo = "A test ps"
$subject = "Re: automated reply"
$Outlook = New-Object -comObject Outlook.Application
$OutlookFolders = $Outlook.Session.Folders.Item($buzon1).Folders
#Map la bandeja de entrada.
$bandeja_de_entrada=$OutlookFolders.Item("INBOX_FOLDER")
#Creamos el objeto que hace referencia a la bandeja de entrada y los mensajes que contiene.
$all_mail=$bandeja_de_entrada.Items
foreach ($mail in $all_mail){
$flag1 = Unread($mail)
if($flag1 -eq $true){
#$mail.to = ""
$mail.body =" $cuerpo" +"$firma"
$mail.subject = $subject
$mail.reply()
}
}
Dont send the email.
Its solved in a answer
powershell email outlook automation reply
Be more specific. What problem are you facing ?
– HariHaran
Nov 15 '18 at 10:29
Dont work $mail.reply(), the email doesnt send. I am ask about method to reply with the historic email
– LCabaAres
Nov 15 '18 at 10:31
add a comment |
Hi again StackOverflow's comunity, I will ask about method ".reply()". This is the code I am trying:
function Unread ($correo) {
if(($correo -eq $null) -or ($correo.Unread.ToString() -like "False")){
$Noleido = $false
}else{
$Noleido = $true
return $Noleido
}
}
$body = "Bla bla bla"
$firma = "I am here"
#$cuerpo = "A test ps"
$subject = "Re: automated reply"
$Outlook = New-Object -comObject Outlook.Application
$OutlookFolders = $Outlook.Session.Folders.Item($buzon1).Folders
#Map la bandeja de entrada.
$bandeja_de_entrada=$OutlookFolders.Item("INBOX_FOLDER")
#Creamos el objeto que hace referencia a la bandeja de entrada y los mensajes que contiene.
$all_mail=$bandeja_de_entrada.Items
foreach ($mail in $all_mail){
$flag1 = Unread($mail)
if($flag1 -eq $true){
#$mail.to = ""
$mail.body =" $cuerpo" +"$firma"
$mail.subject = $subject
$mail.reply()
}
}
Dont send the email.
Its solved in a answer
powershell email outlook automation reply
Hi again StackOverflow's comunity, I will ask about method ".reply()". This is the code I am trying:
function Unread ($correo) {
if(($correo -eq $null) -or ($correo.Unread.ToString() -like "False")){
$Noleido = $false
}else{
$Noleido = $true
return $Noleido
}
}
$body = "Bla bla bla"
$firma = "I am here"
#$cuerpo = "A test ps"
$subject = "Re: automated reply"
$Outlook = New-Object -comObject Outlook.Application
$OutlookFolders = $Outlook.Session.Folders.Item($buzon1).Folders
#Map la bandeja de entrada.
$bandeja_de_entrada=$OutlookFolders.Item("INBOX_FOLDER")
#Creamos el objeto que hace referencia a la bandeja de entrada y los mensajes que contiene.
$all_mail=$bandeja_de_entrada.Items
foreach ($mail in $all_mail){
$flag1 = Unread($mail)
if($flag1 -eq $true){
#$mail.to = ""
$mail.body =" $cuerpo" +"$firma"
$mail.subject = $subject
$mail.reply()
}
}
Dont send the email.
Its solved in a answer
powershell email outlook automation reply
powershell email outlook automation reply
edited Nov 15 '18 at 12:47
LCabaAres
asked Nov 15 '18 at 10:19
LCabaAresLCabaAres
85
85
Be more specific. What problem are you facing ?
– HariHaran
Nov 15 '18 at 10:29
Dont work $mail.reply(), the email doesnt send. I am ask about method to reply with the historic email
– LCabaAres
Nov 15 '18 at 10:31
add a comment |
Be more specific. What problem are you facing ?
– HariHaran
Nov 15 '18 at 10:29
Dont work $mail.reply(), the email doesnt send. I am ask about method to reply with the historic email
– LCabaAres
Nov 15 '18 at 10:31
Be more specific. What problem are you facing ?
– HariHaran
Nov 15 '18 at 10:29
Be more specific. What problem are you facing ?
– HariHaran
Nov 15 '18 at 10:29
Dont work $mail.reply(), the email doesnt send. I am ask about method to reply with the historic email
– LCabaAres
Nov 15 '18 at 10:31
Dont work $mail.reply(), the email doesnt send. I am ask about method to reply with the historic email
– LCabaAres
Nov 15 '18 at 10:31
add a comment |
1 Answer
1
active
oldest
votes
The method reply
creates a MailItem prepopulated with the necessary properties based on the original mail.
If you save the MailItem created by the reply
method to a variable you can then use the method send
to actually send the reply.
Modifying your script to look something like the following would probably work.
$body = "Bla bla bla"
$firma = "I am here"
$subject = "A test ps"
$Outlook = New-Object -comObject Outlook.Application
$OutlookFolders = $Outlook.Session.Folders.Item($buzon1).Folders
#Map la bandeja de entrada.
$bandeja_de_entrada=$OutlookFolders.Item("INBOX_FOLDER")
#Creamos el objeto que hace referencia a la bandeja de entrada y los mensajes que contiene.
$all_mail=$bandeja_de_entrada.Items
foreach ($mail in $all_mail){
#$mail.to = ""
$reply = $mail.reply()
$reply.body = " $cuerpo $firma"
$reply.subject = $subject
$reply.send()
}
If you want to include the original message instead of overwriting it you could change the $reply.body
-line to something like this;
$reply.body = $reply.body + " $cuerpo $firma"
Nice, the email is sending now, but the historic of conversation email isnt go. Of course, if you wanna try the script you must put in $buzon1 your email address.
– LCabaAres
Nov 15 '18 at 11:44
By historic do you mean what was said in the original email? If that's the case then it's because you overwrite the previous value with$reply.body = " $cuerpo $firma"
. I've edited my answer to include a way to add to the body instead of overwriting it.
– notjustme
Nov 15 '18 at 11:54
Very thanks, its working. I edit the original and we can say this is end. Very thanks for the help. I put the concatenation in other order and dont put subject to use the original subject of email with RE:
– LCabaAres
Nov 15 '18 at 12:26
@LCabaAres You should leave your original question the way it was and accept my answer as a solution to your problem. As it is right now you might not help future visitors with the same problem as you had.
– notjustme
Nov 15 '18 at 12:44
ok, I will back the original question.
– LCabaAres
Nov 15 '18 at 12:45
add a 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%2f53317181%2freply-email-powershell%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The method reply
creates a MailItem prepopulated with the necessary properties based on the original mail.
If you save the MailItem created by the reply
method to a variable you can then use the method send
to actually send the reply.
Modifying your script to look something like the following would probably work.
$body = "Bla bla bla"
$firma = "I am here"
$subject = "A test ps"
$Outlook = New-Object -comObject Outlook.Application
$OutlookFolders = $Outlook.Session.Folders.Item($buzon1).Folders
#Map la bandeja de entrada.
$bandeja_de_entrada=$OutlookFolders.Item("INBOX_FOLDER")
#Creamos el objeto que hace referencia a la bandeja de entrada y los mensajes que contiene.
$all_mail=$bandeja_de_entrada.Items
foreach ($mail in $all_mail){
#$mail.to = ""
$reply = $mail.reply()
$reply.body = " $cuerpo $firma"
$reply.subject = $subject
$reply.send()
}
If you want to include the original message instead of overwriting it you could change the $reply.body
-line to something like this;
$reply.body = $reply.body + " $cuerpo $firma"
Nice, the email is sending now, but the historic of conversation email isnt go. Of course, if you wanna try the script you must put in $buzon1 your email address.
– LCabaAres
Nov 15 '18 at 11:44
By historic do you mean what was said in the original email? If that's the case then it's because you overwrite the previous value with$reply.body = " $cuerpo $firma"
. I've edited my answer to include a way to add to the body instead of overwriting it.
– notjustme
Nov 15 '18 at 11:54
Very thanks, its working. I edit the original and we can say this is end. Very thanks for the help. I put the concatenation in other order and dont put subject to use the original subject of email with RE:
– LCabaAres
Nov 15 '18 at 12:26
@LCabaAres You should leave your original question the way it was and accept my answer as a solution to your problem. As it is right now you might not help future visitors with the same problem as you had.
– notjustme
Nov 15 '18 at 12:44
ok, I will back the original question.
– LCabaAres
Nov 15 '18 at 12:45
add a comment |
The method reply
creates a MailItem prepopulated with the necessary properties based on the original mail.
If you save the MailItem created by the reply
method to a variable you can then use the method send
to actually send the reply.
Modifying your script to look something like the following would probably work.
$body = "Bla bla bla"
$firma = "I am here"
$subject = "A test ps"
$Outlook = New-Object -comObject Outlook.Application
$OutlookFolders = $Outlook.Session.Folders.Item($buzon1).Folders
#Map la bandeja de entrada.
$bandeja_de_entrada=$OutlookFolders.Item("INBOX_FOLDER")
#Creamos el objeto que hace referencia a la bandeja de entrada y los mensajes que contiene.
$all_mail=$bandeja_de_entrada.Items
foreach ($mail in $all_mail){
#$mail.to = ""
$reply = $mail.reply()
$reply.body = " $cuerpo $firma"
$reply.subject = $subject
$reply.send()
}
If you want to include the original message instead of overwriting it you could change the $reply.body
-line to something like this;
$reply.body = $reply.body + " $cuerpo $firma"
Nice, the email is sending now, but the historic of conversation email isnt go. Of course, if you wanna try the script you must put in $buzon1 your email address.
– LCabaAres
Nov 15 '18 at 11:44
By historic do you mean what was said in the original email? If that's the case then it's because you overwrite the previous value with$reply.body = " $cuerpo $firma"
. I've edited my answer to include a way to add to the body instead of overwriting it.
– notjustme
Nov 15 '18 at 11:54
Very thanks, its working. I edit the original and we can say this is end. Very thanks for the help. I put the concatenation in other order and dont put subject to use the original subject of email with RE:
– LCabaAres
Nov 15 '18 at 12:26
@LCabaAres You should leave your original question the way it was and accept my answer as a solution to your problem. As it is right now you might not help future visitors with the same problem as you had.
– notjustme
Nov 15 '18 at 12:44
ok, I will back the original question.
– LCabaAres
Nov 15 '18 at 12:45
add a comment |
The method reply
creates a MailItem prepopulated with the necessary properties based on the original mail.
If you save the MailItem created by the reply
method to a variable you can then use the method send
to actually send the reply.
Modifying your script to look something like the following would probably work.
$body = "Bla bla bla"
$firma = "I am here"
$subject = "A test ps"
$Outlook = New-Object -comObject Outlook.Application
$OutlookFolders = $Outlook.Session.Folders.Item($buzon1).Folders
#Map la bandeja de entrada.
$bandeja_de_entrada=$OutlookFolders.Item("INBOX_FOLDER")
#Creamos el objeto que hace referencia a la bandeja de entrada y los mensajes que contiene.
$all_mail=$bandeja_de_entrada.Items
foreach ($mail in $all_mail){
#$mail.to = ""
$reply = $mail.reply()
$reply.body = " $cuerpo $firma"
$reply.subject = $subject
$reply.send()
}
If you want to include the original message instead of overwriting it you could change the $reply.body
-line to something like this;
$reply.body = $reply.body + " $cuerpo $firma"
The method reply
creates a MailItem prepopulated with the necessary properties based on the original mail.
If you save the MailItem created by the reply
method to a variable you can then use the method send
to actually send the reply.
Modifying your script to look something like the following would probably work.
$body = "Bla bla bla"
$firma = "I am here"
$subject = "A test ps"
$Outlook = New-Object -comObject Outlook.Application
$OutlookFolders = $Outlook.Session.Folders.Item($buzon1).Folders
#Map la bandeja de entrada.
$bandeja_de_entrada=$OutlookFolders.Item("INBOX_FOLDER")
#Creamos el objeto que hace referencia a la bandeja de entrada y los mensajes que contiene.
$all_mail=$bandeja_de_entrada.Items
foreach ($mail in $all_mail){
#$mail.to = ""
$reply = $mail.reply()
$reply.body = " $cuerpo $firma"
$reply.subject = $subject
$reply.send()
}
If you want to include the original message instead of overwriting it you could change the $reply.body
-line to something like this;
$reply.body = $reply.body + " $cuerpo $firma"
edited Nov 15 '18 at 11:55
answered Nov 15 '18 at 11:06
notjustmenotjustme
1,29911218
1,29911218
Nice, the email is sending now, but the historic of conversation email isnt go. Of course, if you wanna try the script you must put in $buzon1 your email address.
– LCabaAres
Nov 15 '18 at 11:44
By historic do you mean what was said in the original email? If that's the case then it's because you overwrite the previous value with$reply.body = " $cuerpo $firma"
. I've edited my answer to include a way to add to the body instead of overwriting it.
– notjustme
Nov 15 '18 at 11:54
Very thanks, its working. I edit the original and we can say this is end. Very thanks for the help. I put the concatenation in other order and dont put subject to use the original subject of email with RE:
– LCabaAres
Nov 15 '18 at 12:26
@LCabaAres You should leave your original question the way it was and accept my answer as a solution to your problem. As it is right now you might not help future visitors with the same problem as you had.
– notjustme
Nov 15 '18 at 12:44
ok, I will back the original question.
– LCabaAres
Nov 15 '18 at 12:45
add a comment |
Nice, the email is sending now, but the historic of conversation email isnt go. Of course, if you wanna try the script you must put in $buzon1 your email address.
– LCabaAres
Nov 15 '18 at 11:44
By historic do you mean what was said in the original email? If that's the case then it's because you overwrite the previous value with$reply.body = " $cuerpo $firma"
. I've edited my answer to include a way to add to the body instead of overwriting it.
– notjustme
Nov 15 '18 at 11:54
Very thanks, its working. I edit the original and we can say this is end. Very thanks for the help. I put the concatenation in other order and dont put subject to use the original subject of email with RE:
– LCabaAres
Nov 15 '18 at 12:26
@LCabaAres You should leave your original question the way it was and accept my answer as a solution to your problem. As it is right now you might not help future visitors with the same problem as you had.
– notjustme
Nov 15 '18 at 12:44
ok, I will back the original question.
– LCabaAres
Nov 15 '18 at 12:45
Nice, the email is sending now, but the historic of conversation email isnt go. Of course, if you wanna try the script you must put in $buzon1 your email address.
– LCabaAres
Nov 15 '18 at 11:44
Nice, the email is sending now, but the historic of conversation email isnt go. Of course, if you wanna try the script you must put in $buzon1 your email address.
– LCabaAres
Nov 15 '18 at 11:44
By historic do you mean what was said in the original email? If that's the case then it's because you overwrite the previous value with
$reply.body = " $cuerpo $firma"
. I've edited my answer to include a way to add to the body instead of overwriting it.– notjustme
Nov 15 '18 at 11:54
By historic do you mean what was said in the original email? If that's the case then it's because you overwrite the previous value with
$reply.body = " $cuerpo $firma"
. I've edited my answer to include a way to add to the body instead of overwriting it.– notjustme
Nov 15 '18 at 11:54
Very thanks, its working. I edit the original and we can say this is end. Very thanks for the help. I put the concatenation in other order and dont put subject to use the original subject of email with RE:
– LCabaAres
Nov 15 '18 at 12:26
Very thanks, its working. I edit the original and we can say this is end. Very thanks for the help. I put the concatenation in other order and dont put subject to use the original subject of email with RE:
– LCabaAres
Nov 15 '18 at 12:26
@LCabaAres You should leave your original question the way it was and accept my answer as a solution to your problem. As it is right now you might not help future visitors with the same problem as you had.
– notjustme
Nov 15 '18 at 12:44
@LCabaAres You should leave your original question the way it was and accept my answer as a solution to your problem. As it is right now you might not help future visitors with the same problem as you had.
– notjustme
Nov 15 '18 at 12:44
ok, I will back the original question.
– LCabaAres
Nov 15 '18 at 12:45
ok, I will back the original question.
– LCabaAres
Nov 15 '18 at 12:45
add a 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%2f53317181%2freply-email-powershell%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
Be more specific. What problem are you facing ?
– HariHaran
Nov 15 '18 at 10:29
Dont work $mail.reply(), the email doesnt send. I am ask about method to reply with the historic email
– LCabaAres
Nov 15 '18 at 10:31