Modify date in email header using script with mailxSend the Output of an HTML file within the email body...

The Game of the Century - why didn't Byrne take the rook after he forked Fischer?

If a vampire drinks blood of a sick human, does the vampire get infected?

How easy is it to get a gun illegally in the United States?

Does a humanoid possessed by a ghost register as undead to a paladin's Divine Sense?

How can I perform a deterministic physics simulation?

Why do scoped enums allow use of | operator when initializing using previously assigned values?

How to call made-up data?

Write The Shortest Program To Check If A Binary Tree Is Balanced

Repeated! Factorials!

If the interviewer says "We have other interviews to conduct and then back to you in few days", is it a bad sign to not get the job?

How do I get the =LEFT function in excel, to also take the number zero as the first number?

Is the first page of a novel really that important?

Writing computer program code for free in an interview?

I was contacted by a private bank overseas to get my inheritance

Did Captain America make out with his niece?

Ubuntu show wrong disk sizes, how to solve it?

How and where to get you research work assessed for PhD?

…down the primrose path

What does the ISO setting for mechanical 35mm film cameras actually do?

Is there a way to say "double + any number" in German?

Why is Chromosome 1 called Chromosome 1?

Make a living as a math programming freelancer?

Vibration on the guitar when playing two strings

Why am I not getting stuck in the loop



Modify date in email header using script with mailx


Send the Output of an HTML file within the email body using mailxSending attachments with mailx and uuencodeBold and Underline using echo with emailSending HTML using mailx with postfix 2.6.6 and centOS 6.4MailX not sending email when run as a Systemd serviceHTML email from heirloom mailx on linuxSetup simple Automation system using Emailsend email from terminal bad behaviourTrouble Sending file content in the mail body with mailxLinux Mailx is creating a dead.letter and not sending email






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I am trying to modify a script which grabs data from a database and puts it into the message of an email which is then sent out using mailx. What I need to do is grab the date which is in the first line of the message body and use that as the date in the header. These emails get ingested by another system and the only way to search these emails properly by date is to include the date from the body as the header date. We sometimes run into an issue where the script does not run and we manually re run the emails. As a result, they get stamped with the current date/time rather than when the data was originally created. I know how to put the date in the message body and/or the subject, but I really need to just modify the header date.










share|improve this question















bumped to the homepage by Community 1 hour ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















  • "grab the date from the first line" or "modify the header date"? In your description it's unclear how your data is actually available for processing. Is your data in a file and you want to extract the significant date from the first line in the file (sed "1q") or do you want to replace the date in the first line in the file by the actual date (sed "1s/.*/$(date)/")?

    – Janis
    Mar 11 '15 at 0:06













  • The data is being pulled from a mySql database and is a series of instant messages that get aggregated by conversation into the message body. The first line in that body of text contains the date and time the conversation started. So assuming I can pull that value into a variable, I'm hoping I can use that variable to modify the header information for the email date.

    – Kenneth Libeson
    Mar 11 '15 at 0:13


















0















I am trying to modify a script which grabs data from a database and puts it into the message of an email which is then sent out using mailx. What I need to do is grab the date which is in the first line of the message body and use that as the date in the header. These emails get ingested by another system and the only way to search these emails properly by date is to include the date from the body as the header date. We sometimes run into an issue where the script does not run and we manually re run the emails. As a result, they get stamped with the current date/time rather than when the data was originally created. I know how to put the date in the message body and/or the subject, but I really need to just modify the header date.










share|improve this question















bumped to the homepage by Community 1 hour ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















  • "grab the date from the first line" or "modify the header date"? In your description it's unclear how your data is actually available for processing. Is your data in a file and you want to extract the significant date from the first line in the file (sed "1q") or do you want to replace the date in the first line in the file by the actual date (sed "1s/.*/$(date)/")?

    – Janis
    Mar 11 '15 at 0:06













  • The data is being pulled from a mySql database and is a series of instant messages that get aggregated by conversation into the message body. The first line in that body of text contains the date and time the conversation started. So assuming I can pull that value into a variable, I'm hoping I can use that variable to modify the header information for the email date.

    – Kenneth Libeson
    Mar 11 '15 at 0:13














0












0








0








I am trying to modify a script which grabs data from a database and puts it into the message of an email which is then sent out using mailx. What I need to do is grab the date which is in the first line of the message body and use that as the date in the header. These emails get ingested by another system and the only way to search these emails properly by date is to include the date from the body as the header date. We sometimes run into an issue where the script does not run and we manually re run the emails. As a result, they get stamped with the current date/time rather than when the data was originally created. I know how to put the date in the message body and/or the subject, but I really need to just modify the header date.










share|improve this question














I am trying to modify a script which grabs data from a database and puts it into the message of an email which is then sent out using mailx. What I need to do is grab the date which is in the first line of the message body and use that as the date in the header. These emails get ingested by another system and the only way to search these emails properly by date is to include the date from the body as the header date. We sometimes run into an issue where the script does not run and we manually re run the emails. As a result, they get stamped with the current date/time rather than when the data was originally created. I know how to put the date in the message body and/or the subject, but I really need to just modify the header date.







email date mailx






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 10 '15 at 23:55









Kenneth LibesonKenneth Libeson

1




1






bumped to the homepage by Community 1 hour ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.









bumped to the homepage by Community 1 hour ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 1 hour ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • "grab the date from the first line" or "modify the header date"? In your description it's unclear how your data is actually available for processing. Is your data in a file and you want to extract the significant date from the first line in the file (sed "1q") or do you want to replace the date in the first line in the file by the actual date (sed "1s/.*/$(date)/")?

    – Janis
    Mar 11 '15 at 0:06













  • The data is being pulled from a mySql database and is a series of instant messages that get aggregated by conversation into the message body. The first line in that body of text contains the date and time the conversation started. So assuming I can pull that value into a variable, I'm hoping I can use that variable to modify the header information for the email date.

    – Kenneth Libeson
    Mar 11 '15 at 0:13



















  • "grab the date from the first line" or "modify the header date"? In your description it's unclear how your data is actually available for processing. Is your data in a file and you want to extract the significant date from the first line in the file (sed "1q") or do you want to replace the date in the first line in the file by the actual date (sed "1s/.*/$(date)/")?

    – Janis
    Mar 11 '15 at 0:06













  • The data is being pulled from a mySql database and is a series of instant messages that get aggregated by conversation into the message body. The first line in that body of text contains the date and time the conversation started. So assuming I can pull that value into a variable, I'm hoping I can use that variable to modify the header information for the email date.

    – Kenneth Libeson
    Mar 11 '15 at 0:13

















"grab the date from the first line" or "modify the header date"? In your description it's unclear how your data is actually available for processing. Is your data in a file and you want to extract the significant date from the first line in the file (sed "1q") or do you want to replace the date in the first line in the file by the actual date (sed "1s/.*/$(date)/")?

– Janis
Mar 11 '15 at 0:06







"grab the date from the first line" or "modify the header date"? In your description it's unclear how your data is actually available for processing. Is your data in a file and you want to extract the significant date from the first line in the file (sed "1q") or do you want to replace the date in the first line in the file by the actual date (sed "1s/.*/$(date)/")?

– Janis
Mar 11 '15 at 0:06















The data is being pulled from a mySql database and is a series of instant messages that get aggregated by conversation into the message body. The first line in that body of text contains the date and time the conversation started. So assuming I can pull that value into a variable, I'm hoping I can use that variable to modify the header information for the email date.

– Kenneth Libeson
Mar 11 '15 at 0:13





The data is being pulled from a mySql database and is a series of instant messages that get aggregated by conversation into the message body. The first line in that body of text contains the date and time the conversation started. So assuming I can pull that value into a variable, I'm hoping I can use that variable to modify the header information for the email date.

– Kenneth Libeson
Mar 11 '15 at 0:13










1 Answer
1






active

oldest

votes


















0














If you stored the extracted database data in a file before you send it per mail you can use something along



mailx -s "$( sed 1q yourfile )" user@domain < yourfile





share|improve this answer


























  • Not sure I follow. this looks like you are pulling the value from my file and putting it in the subject as it follows '-s'. I need to modify the time the email is sent which I understand to be a header value. I was wondering if I needed to use '-S' and then define the variable to change and the value to assign it.

    – Kenneth Libeson
    Mar 11 '15 at 0:30











  • To be clear, let's say I have an email I am sending out today. I want to be able to state that it was actually sent on 1/1/99. Let's assume I have the value 1/1/99 stored somewhere. I just want to focus on getting that value into the email header so the recipient sees the email as being sent on 1/1/99. I'm not worried about how to grab the value to use.

    – Kenneth Libeson
    Mar 11 '15 at 0:36











  • Oh, you want to "trick" the email timestamp? You'd then have to edit the raw mail, set in the header block the Date: ... field, and send the resulting file. (In former days ISTR that you could send raw mails with the mail program (as opposed to mailx) but now my man page seems to suggest that mail and mailx are equivalent programs.) Beyond those hints I cannot help further, I fear.

    – Janis
    Mar 11 '15 at 0:39













  • Thanks, yes that's why I am trying to do. Thanks for trying. I'll keep searching. I gather I could form the header info along with the body details and send that out, but I'm not that savvy to understand how to send the raw file as the entire email.

    – Kenneth Libeson
    Mar 11 '15 at 3:17











  • The old mail program had to be fed with the whole raw mail like you feed the mailx with the mail body, from stdin. Just keep a blank line between mail header and body. One more idea that came to my mind; this may sound strange in the first moment but you can use telnet to send raw mails. For details search for keywords "telnet send mail", or here's a link for the start: spamsoap.com/…

    – Janis
    Mar 11 '15 at 11:07














Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2funix.stackexchange.com%2fquestions%2f189409%2fmodify-date-in-email-header-using-script-with-mailx%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














If you stored the extracted database data in a file before you send it per mail you can use something along



mailx -s "$( sed 1q yourfile )" user@domain < yourfile





share|improve this answer


























  • Not sure I follow. this looks like you are pulling the value from my file and putting it in the subject as it follows '-s'. I need to modify the time the email is sent which I understand to be a header value. I was wondering if I needed to use '-S' and then define the variable to change and the value to assign it.

    – Kenneth Libeson
    Mar 11 '15 at 0:30











  • To be clear, let's say I have an email I am sending out today. I want to be able to state that it was actually sent on 1/1/99. Let's assume I have the value 1/1/99 stored somewhere. I just want to focus on getting that value into the email header so the recipient sees the email as being sent on 1/1/99. I'm not worried about how to grab the value to use.

    – Kenneth Libeson
    Mar 11 '15 at 0:36











  • Oh, you want to "trick" the email timestamp? You'd then have to edit the raw mail, set in the header block the Date: ... field, and send the resulting file. (In former days ISTR that you could send raw mails with the mail program (as opposed to mailx) but now my man page seems to suggest that mail and mailx are equivalent programs.) Beyond those hints I cannot help further, I fear.

    – Janis
    Mar 11 '15 at 0:39













  • Thanks, yes that's why I am trying to do. Thanks for trying. I'll keep searching. I gather I could form the header info along with the body details and send that out, but I'm not that savvy to understand how to send the raw file as the entire email.

    – Kenneth Libeson
    Mar 11 '15 at 3:17











  • The old mail program had to be fed with the whole raw mail like you feed the mailx with the mail body, from stdin. Just keep a blank line between mail header and body. One more idea that came to my mind; this may sound strange in the first moment but you can use telnet to send raw mails. For details search for keywords "telnet send mail", or here's a link for the start: spamsoap.com/…

    – Janis
    Mar 11 '15 at 11:07
















0














If you stored the extracted database data in a file before you send it per mail you can use something along



mailx -s "$( sed 1q yourfile )" user@domain < yourfile





share|improve this answer


























  • Not sure I follow. this looks like you are pulling the value from my file and putting it in the subject as it follows '-s'. I need to modify the time the email is sent which I understand to be a header value. I was wondering if I needed to use '-S' and then define the variable to change and the value to assign it.

    – Kenneth Libeson
    Mar 11 '15 at 0:30











  • To be clear, let's say I have an email I am sending out today. I want to be able to state that it was actually sent on 1/1/99. Let's assume I have the value 1/1/99 stored somewhere. I just want to focus on getting that value into the email header so the recipient sees the email as being sent on 1/1/99. I'm not worried about how to grab the value to use.

    – Kenneth Libeson
    Mar 11 '15 at 0:36











  • Oh, you want to "trick" the email timestamp? You'd then have to edit the raw mail, set in the header block the Date: ... field, and send the resulting file. (In former days ISTR that you could send raw mails with the mail program (as opposed to mailx) but now my man page seems to suggest that mail and mailx are equivalent programs.) Beyond those hints I cannot help further, I fear.

    – Janis
    Mar 11 '15 at 0:39













  • Thanks, yes that's why I am trying to do. Thanks for trying. I'll keep searching. I gather I could form the header info along with the body details and send that out, but I'm not that savvy to understand how to send the raw file as the entire email.

    – Kenneth Libeson
    Mar 11 '15 at 3:17











  • The old mail program had to be fed with the whole raw mail like you feed the mailx with the mail body, from stdin. Just keep a blank line between mail header and body. One more idea that came to my mind; this may sound strange in the first moment but you can use telnet to send raw mails. For details search for keywords "telnet send mail", or here's a link for the start: spamsoap.com/…

    – Janis
    Mar 11 '15 at 11:07














0












0








0







If you stored the extracted database data in a file before you send it per mail you can use something along



mailx -s "$( sed 1q yourfile )" user@domain < yourfile





share|improve this answer













If you stored the extracted database data in a file before you send it per mail you can use something along



mailx -s "$( sed 1q yourfile )" user@domain < yourfile






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 11 '15 at 0:19









JanisJanis

10.6k2 gold badges17 silver badges38 bronze badges




10.6k2 gold badges17 silver badges38 bronze badges
















  • Not sure I follow. this looks like you are pulling the value from my file and putting it in the subject as it follows '-s'. I need to modify the time the email is sent which I understand to be a header value. I was wondering if I needed to use '-S' and then define the variable to change and the value to assign it.

    – Kenneth Libeson
    Mar 11 '15 at 0:30











  • To be clear, let's say I have an email I am sending out today. I want to be able to state that it was actually sent on 1/1/99. Let's assume I have the value 1/1/99 stored somewhere. I just want to focus on getting that value into the email header so the recipient sees the email as being sent on 1/1/99. I'm not worried about how to grab the value to use.

    – Kenneth Libeson
    Mar 11 '15 at 0:36











  • Oh, you want to "trick" the email timestamp? You'd then have to edit the raw mail, set in the header block the Date: ... field, and send the resulting file. (In former days ISTR that you could send raw mails with the mail program (as opposed to mailx) but now my man page seems to suggest that mail and mailx are equivalent programs.) Beyond those hints I cannot help further, I fear.

    – Janis
    Mar 11 '15 at 0:39













  • Thanks, yes that's why I am trying to do. Thanks for trying. I'll keep searching. I gather I could form the header info along with the body details and send that out, but I'm not that savvy to understand how to send the raw file as the entire email.

    – Kenneth Libeson
    Mar 11 '15 at 3:17











  • The old mail program had to be fed with the whole raw mail like you feed the mailx with the mail body, from stdin. Just keep a blank line between mail header and body. One more idea that came to my mind; this may sound strange in the first moment but you can use telnet to send raw mails. For details search for keywords "telnet send mail", or here's a link for the start: spamsoap.com/…

    – Janis
    Mar 11 '15 at 11:07



















  • Not sure I follow. this looks like you are pulling the value from my file and putting it in the subject as it follows '-s'. I need to modify the time the email is sent which I understand to be a header value. I was wondering if I needed to use '-S' and then define the variable to change and the value to assign it.

    – Kenneth Libeson
    Mar 11 '15 at 0:30











  • To be clear, let's say I have an email I am sending out today. I want to be able to state that it was actually sent on 1/1/99. Let's assume I have the value 1/1/99 stored somewhere. I just want to focus on getting that value into the email header so the recipient sees the email as being sent on 1/1/99. I'm not worried about how to grab the value to use.

    – Kenneth Libeson
    Mar 11 '15 at 0:36











  • Oh, you want to "trick" the email timestamp? You'd then have to edit the raw mail, set in the header block the Date: ... field, and send the resulting file. (In former days ISTR that you could send raw mails with the mail program (as opposed to mailx) but now my man page seems to suggest that mail and mailx are equivalent programs.) Beyond those hints I cannot help further, I fear.

    – Janis
    Mar 11 '15 at 0:39













  • Thanks, yes that's why I am trying to do. Thanks for trying. I'll keep searching. I gather I could form the header info along with the body details and send that out, but I'm not that savvy to understand how to send the raw file as the entire email.

    – Kenneth Libeson
    Mar 11 '15 at 3:17











  • The old mail program had to be fed with the whole raw mail like you feed the mailx with the mail body, from stdin. Just keep a blank line between mail header and body. One more idea that came to my mind; this may sound strange in the first moment but you can use telnet to send raw mails. For details search for keywords "telnet send mail", or here's a link for the start: spamsoap.com/…

    – Janis
    Mar 11 '15 at 11:07

















Not sure I follow. this looks like you are pulling the value from my file and putting it in the subject as it follows '-s'. I need to modify the time the email is sent which I understand to be a header value. I was wondering if I needed to use '-S' and then define the variable to change and the value to assign it.

– Kenneth Libeson
Mar 11 '15 at 0:30





Not sure I follow. this looks like you are pulling the value from my file and putting it in the subject as it follows '-s'. I need to modify the time the email is sent which I understand to be a header value. I was wondering if I needed to use '-S' and then define the variable to change and the value to assign it.

– Kenneth Libeson
Mar 11 '15 at 0:30













To be clear, let's say I have an email I am sending out today. I want to be able to state that it was actually sent on 1/1/99. Let's assume I have the value 1/1/99 stored somewhere. I just want to focus on getting that value into the email header so the recipient sees the email as being sent on 1/1/99. I'm not worried about how to grab the value to use.

– Kenneth Libeson
Mar 11 '15 at 0:36





To be clear, let's say I have an email I am sending out today. I want to be able to state that it was actually sent on 1/1/99. Let's assume I have the value 1/1/99 stored somewhere. I just want to focus on getting that value into the email header so the recipient sees the email as being sent on 1/1/99. I'm not worried about how to grab the value to use.

– Kenneth Libeson
Mar 11 '15 at 0:36













Oh, you want to "trick" the email timestamp? You'd then have to edit the raw mail, set in the header block the Date: ... field, and send the resulting file. (In former days ISTR that you could send raw mails with the mail program (as opposed to mailx) but now my man page seems to suggest that mail and mailx are equivalent programs.) Beyond those hints I cannot help further, I fear.

– Janis
Mar 11 '15 at 0:39







Oh, you want to "trick" the email timestamp? You'd then have to edit the raw mail, set in the header block the Date: ... field, and send the resulting file. (In former days ISTR that you could send raw mails with the mail program (as opposed to mailx) but now my man page seems to suggest that mail and mailx are equivalent programs.) Beyond those hints I cannot help further, I fear.

– Janis
Mar 11 '15 at 0:39















Thanks, yes that's why I am trying to do. Thanks for trying. I'll keep searching. I gather I could form the header info along with the body details and send that out, but I'm not that savvy to understand how to send the raw file as the entire email.

– Kenneth Libeson
Mar 11 '15 at 3:17





Thanks, yes that's why I am trying to do. Thanks for trying. I'll keep searching. I gather I could form the header info along with the body details and send that out, but I'm not that savvy to understand how to send the raw file as the entire email.

– Kenneth Libeson
Mar 11 '15 at 3:17













The old mail program had to be fed with the whole raw mail like you feed the mailx with the mail body, from stdin. Just keep a blank line between mail header and body. One more idea that came to my mind; this may sound strange in the first moment but you can use telnet to send raw mails. For details search for keywords "telnet send mail", or here's a link for the start: spamsoap.com/…

– Janis
Mar 11 '15 at 11:07





The old mail program had to be fed with the whole raw mail like you feed the mailx with the mail body, from stdin. Just keep a blank line between mail header and body. One more idea that came to my mind; this may sound strange in the first moment but you can use telnet to send raw mails. For details search for keywords "telnet send mail", or here's a link for the start: spamsoap.com/…

– Janis
Mar 11 '15 at 11:07


















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • 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%2funix.stackexchange.com%2fquestions%2f189409%2fmodify-date-in-email-header-using-script-with-mailx%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

Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...