Shell Script To Send Email After Authenticaton

Dear All,

I am not an expert with Linux so I am seeking your help. I want to send some email from Linux through Microsoft Exchange server 2013 which requires authentication. This exchange server doesn't allow sending anonymous email. Previously I am sending email using "mail -s" command. Can you guys please help me to achieve this. Any heko would greatly be appreciated. By the way I am using Oracle Linux 6.6.


Similar Content



Sending Mail From Command Line

I searched the forums for my title and I am not finding exactly what I am looking for. I am not using a program to send mail, such as Thunderbird or whatever. I simply want to be able to send mail from my Ubuntu 14.04 DESKTOP version for logging. I use a program called Logwatch (used alot in RHEL or CentOS) to monitor the server itself. The program sends mail to the root user account on the machine, which I can check and see, and within the program conf file, I can add an external email address, but it never sends.

I'm familiar with the SMTP concept of sending mail, outgoing mail server authentication, etc. I don't care to run this box as an SMTP server, but I understand that I need some sort of SMTP or MTA program to send mail into the real world. I tried Postfix but couldn't get that to work, and the Logwatch program wants to use sendmail, so I installed that but I am having the same issue. I am sure it is a step I am missing.

I also can't figure out how to get the 'mail' cmd from Terminal to work. I use this command:
Code:
mail -s "test" | /usr/sbin/mail myemail@domain.com

it follows through the subject, CC, body, but when I try to hit either . or CTRL-D, it never sends the email, in fact is does nothing.

I also tried sendmail with this command:
Code:
sendmail -v my@email.com < /dev/null

I was just trying to send a test email. It logs into my SMTP mail server, which I already configured, and it tells me to type out the mail, then end with a "." by itself on a single line. I try this and it just sits there.

I am missing SOMETHING when trying to actually send the mail. I can get it written with subject and body, connected, but it never sends and I am probably missing a / or something.

I did find and follow these instructions, but it still isn't working with sendmail. If I need to go back to Postfix, I can do that, I don't honestly care what I use, I just want some programs such as Logwatch to be able to email me.
http://stackoverflow.com/questions/1...mail-on-ubuntu

Bash More Commands In One Function

hello

first year of learning linux and bash script
Now i wrote a bash script with a function.
Today i recieved a email from my teacher that 1 function only can have 1 command and no more then 1?

thats a part of the script

Code:
function tx_unreachable_msg()
{
LOGLINE="[$DATE] no ip service unreachable"
typewriter "$NOIPSERVICE niet bereikbaar" .1
sleep 1 
typewriter "Mail wordt verzonden naar $email" .1
mail -s "NO ip mail error" "$email"<<EOF
dynupdate.no-ip.com niet bereikbaar @ $DATE
EOF
}

it's part dutch part english but the point is that the first LOGLINE is forbidden in the function because i use the functie to send a mail end not to write a logline but that's a part of the command in my case?

So what does this function?
If the no ip service is unreachable then it's write to /etc/var/log/no-ip and after the sleep it's send a simpel mail to the adres in the variabele mail.

i read here at the first line:
Quote:
Shell functions are a way to group commands for later execution using a single name for the group.
so is it true that my function is wrong and so no can someone point me to a website where it's say that more commands are allow in 1 function0

grts b

Mail Using Telnet SMTP

Hi All,

I am trying to send email using telnet to smtp as mailx and other functionality is restricted by administrator.

I am not able to figure out as how to attach any text or any file using the below.

I am following all instructions and steps as shown at http://exchange.mvps.org/smtp_frames.htm

1. telnet <servername> 25
2. helo <your domain name><enter>
3. mail from: <your Email Address><enter>
response should be as follows
250 OK - mail from <your Email address>

rcpt to: <recipient address><enter>
response should be as follows
250 OK - Recipient <recipient address>

data<enter>
response should be as follows
354 Send data. End with CRLF.CRLF

To: <recipient's display name><enter>
From: <your display name><enter>
Subject: <Subject field of Email message><enter>
<Enter you body text><enter><enter> . <enter>
response should be as follows
250 OK

quit<enter>

Mutt Does Not Show Full Subject

I use following shell script to send email. But the subject of email always shows "This" instead of "This is L_1.R is finished". You may refer http://www.linuxquestions.org/questions/linux-newbie-8/how-to-define-variable-in-%60ssh%60-4175540566/
Code:
host_list=("c15-0330-01.ad.mtu.edu" "c15-0330-02.ad.mtu.edu" "c15-0330-03.ad.mtu.edu" "c15-0330-04.ad.mtu.edu")
program=("L_1" "L_2" "L_3" "L_4")
subject="The job is finished"
ssh -f c15-0330-01.ad.mtu.edu 'echo' "the job ${program[0]} is finished" '|' 'mutt "zwang10@mtu.edu" -s' "This is "${program[0]}".R is finished";

Script Automatic Send Email Using Crontab

Hello,

I have server but it all hardening.i can't install mailx and sendmail. How could i do script to automatic send email to my mailbox using crontab?

any idea guy.

Thanks for the help.

Samhan

Sendmail Alias Not Working

I'm trying to send all root's mails to an external e-mailaddress, but for some reason I can't get it to work.

I've edited /etc/aliases with the following rule:

root: <myexternal@email.address>

and run newaliasses after, which would run without any errors.

I can run: echo "Testing" | mail -s "Server Testing" <myexternal@email.address>
just fine without any issue and it's being delivered correctly to my external address.

But when I run: echo "Testing" | mail -s "Server Testing" root

I (first) get a "Deferred: 451 Temporary local problem - please try again later" error and when I then run: "Sendmail -OTimeout.hoststatus=0m -q -v" to flush the mailqueue it says everything is ok, but I then get a message saying I have new mail in /var/spool/mail/root and I don't get the mail on my external e-mailaddress.

I have no clue where to look next, hopefully you guys can point me in the right direction.

Just for completeness: I use mageia release 4 (x86_x64).

Qmail Help

Hi All,
We have qmail server running on RHEL6.5. We have already made sure that our server is not acting as an open relay with the help of http://mxtoolbox.com/diagnostic.aspx.
But still anyone can telnet to our domain and send fake emails to anybody@ourdomain.com. For example Code:
telnet mail.ourdomain.com 25
helo mail.ourdomain.com
mail from: unknown@anyname.com
rcpt to: anyemailid@ourdomain.com
data
from: "Any Unknow name" <unknown@anyname.com>
to: "Some user Name" <anyemailid@ourdomain.com>
subject: Testing MTA with telnet

Hi,
This way anybody can fool us.

Regards,

.
quit

So can anybody pls help me to prevent this. I meant to say, we should not block port 25, instead it should verify whether or not "from email id" is exist in our domain, if it is exist then it should ask for the password also or if it is not exist then also it should not take us to next step. Because as per above example anybody can fool us as the mail is coming from outside but it is just from our domain to our domain without any authentication!!!
Expecting your kind help to block sending mails in this way.

Convert Txt To 3 Column Html

I have a server sending me a plain text email every day, reporting the below parameters. Its reading them from a text file, and sending them to my email.

How can convert this to a three column html table and send that?

Code:
Sync Total: 1 directory, 4 files, 0 symlinks
---------------------------------
Host Name: host name here
---------------------------------
Group Name: group name here
---------------------------------
Disk Usage: 37%
---------------------------------
CPU Usage: 78%
---------------------------------
Memory Usage: 11%
---------------------------------
Temperatu  44.9'C
---------------------------------
Local IP: 192.168.0.115
---------------------------------
Public IP: public ip here
---------------------------------
Tunnel Port: 5001
---------------------------------
Tunnel Status:
Fri Mar 6 06:23:00 EET 2015 opening reverse tunnel from my_host_he 5001 to 127.0.0.1:22
---------------------------------

Thanks

Which Distro Would Be Best To Use For An In-house Email Server?

I am NEW to Linux. the most experience I have is I like to use Linux boot disks like knoppix and puppy. But I have been commissioned to build an email server for our company. I say build, but there already is a server here woth Redhat rel 9 (shrike) ker 2.4.26 already installed. The problem is, the last IT guy left and nobody knows the login info. I can't log into it. Should I re-install and just delete the partition, or is there a workaround?

Thank you to anyone who can help me....

Creating Icedove Email Account - What's Going On?

I have Debian 7.7 and have just installed Icedove email client.
I want to create a free email address so I can have a new email account.

When I launch Icedove, I get a window saying 'Would you like a new email address?'
It then offers a search button for email addresses. Why? If I create an address it will need to be unique - so there's nothing for it to find.
Also, I input an email address I want and it seemed to be saying that the propietary host server (in this case gandi.net) wanted £4 ($6) for the account.

Can someone please say a little more about Icedove? Believe me, there is little to learn from Youtube and the internet.