Location>code7788 >text

Widget to send emails using Curl commands

Popularity:892 ℃/2024-08-01 15:04:52

A small tool to send emails using curl

  • In fact, it can be expanded to include many other ways to play
  • Example:
    • With the system timer task to do system status monitoring, when certain conditions are met, automatically send emails.
    • Or like the author, every time you are too lazy to edit the email after working overtime, you can just pass in the appropriate parameters to send the email
    • Or... Other scenarios that may require email
  • Explanation of fields
    • USER: mailbox account name and password, use English colon in the middle.:split
    • From: Mail source to
    • To: Mail Target
    • Cc: copy target
    • Subject... : If you don't want your email to be a mess, don't change it!
    • Hi, all... From here on, it's all about the e-mail.
  • The e-mail addresses in the case are for demonstration purposes and need to be replaced when used.
#!/bin/bash

NAME="modal particle indicating that things should only or can only be done a certain way"
#account name:cryptographic
USER="luobei@:lb123123"
CUR_DATE=`date | awk '{print $1$2$3" "$4}'`
#Overtime hours
HOUR=${1}
#Reason for overtime
CAUSE=${2}

echo \
"From: <luobei@>
To: <kaoqin@>
Cc: <kaoqin@>
Subject:=?utf-8?utf-8?Overtime requests-${NAME}?=
Content-Type: text/plain; charset="utf-8"
ontent-Transfer-Encoding:8bit

hi,all:
    ${CUR_DATE}  work overtime${HOUR}hourly(${CAUSE})

" > ./

curl -vs --url "smtps://:465" \
--mail-from "luobei@" \
--mail-rcpt "kaoqin@" \
--mail-rcpt "kaoqin@" \
--upload-file \
--user ${USER}