Reply email powershell












0















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










share|improve this question

























  • 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
















0















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










share|improve this question

























  • 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














0












0








0








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










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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



















  • 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












1 Answer
1






active

oldest

votes


















0














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"





share|improve this answer


























  • 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













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
});


}
});














draft saved

draft discarded


















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









0














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"





share|improve this answer


























  • 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


















0














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"





share|improve this answer


























  • 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
















0












0








0







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"





share|improve this answer















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"






share|improve this answer














share|improve this answer



share|improve this answer








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





















  • 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






















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Bressuire

Vorschmack

Quarantine