KSH Send Email Attachments Using a Scripts

www‮tual.‬turi.com
KSH Send Email Attachments Using a Scripts

To send email attachments using a script in KSH (Korn Shell), you can use the mailx command.

Here is an example of a script that sends an email with an attachment using mailx:

# Set the email subject and recipient
subject="Example email with attachment"
to="recipient@example.com"

# Set the path to the attachment file
attachment="/path/to/attachment.pdf"

# Send the email with the attachment
echo "This is the body of the email" | mailx -s "$subject" -a "$attachment" "$to"

This will send an email with the subject "Example email with attachment" and the attachment "attachment.pdf" to the recipient "recipient@example.com". The body of the email will be "This is the body of the email".

It is important to note that the mailx command may not be available on all Unix and Linux systems, and may require additional configuration to work with certain email servers.

For more information on using the mailx command to send email attachments, you can consult the mailx manual or online documentation.

Created Time:2017-10-29 22:08:50  Author:lautturi