Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

how to send mail from linux with .txt file as attachment ..

user616124Apr 29 2008 — edited Apr 30 2008
I want to send email from linux box and in the body of the email i want to have the content of dblog.txt file.


I want dglob.txt file content to be part of the mail body.

Thanks in advance!!

Comments

498375
cat filename | mail -s "subject" email@address
498375
or

mail -s "subject" -a /attachment email@address

if you want to sent as attachment.
user616124
i did .i didnt get any errors but
i dont see any email in inbox.
for using mail do we have to have some kind of setups ?
Ivan Kartik
Is there some Antispam software on SMTP?
What kind of mail SW are you using? Sendmail/Postfix/Qmail/Exim?
What distribution of Linux are you using?

Check /var/log/maillog or /var/log/mail.log (depends on configuration of syslog) for more information about your mail message.
user616124
in /var/log/maillog I see:

Apr 29 14:25:06 lctwprddb01 sendmail[31387]: m3TIP6Ze031387: to=ngoradia@lifecell.com, ctladdr=oracle (500/500), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30107, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m3TIP6LJ031388 Message accepted for delivery)
user616124
we use Red Hat 5.
user616124
when i do ps -ef | grep mail it shows me :

TWPRD> ps -ef | grep mail
root 2588 1 0 Apr04 ? 00:00:00 sendmail: accepting connections
smmsp 2595 1 0 Apr04 ? 00:00:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue
root 30209 2588 0 13:59 ? 00:00:00 sendmail: ./m3TFx113025116 cluster2.us.messagelabs.com.: user open
root 31178 1 0 14:21 ? 00:00:00 sendmail: ./m3TILs2r031176 cluster2.us.messagelabs.com.: user open
root 31390 1 0 14:25 ? 00:00:00 sendmail: ./m3TIP6LJ031388 cluster2.us.messagelabs.com.: user open
oracle 31600 31570 0 14:29 pts/1 00:00:00 grep mail
[oracle] "lctwprddb01.lifecell.biz:"/home/oracle:
TWPRD>
Ivan Kartik
There should be more messages with message id "m3TIP6Ze031387" in mail log.
Can you post them all?
user616124
I just killed all processes which i was seing by ps -ef | grep sendmail

than i started sendmail again using :
/usr/sbin/sendmail -bd -q3m

than from oracle user i have cat oraerror.log | mailx -s " test " ngoradia@lifecell.com

I see in log file as:
Apr 29 15:16:51 lctwprddb01 sendmail[1421]: starting daemon (8.13.8): SMTP+queueing@00:03:00
Apr 29 15:19:35 lctwprddb01 sendmail[1616]: m3TJJZ4k001616: from=oracle, size=109, class=0, nrcpts=1, msgid=<200804291919.m3TJJZ4k001616@lctwprddb01.lifecell.biz>, relay=oracle@localhost
Apr 29 15:19:35 lctwprddb01 sendmail[1617]: m3TJJZhB001617: from=<oracle@lctwprddb01.lifecell.biz>, size=425, class=0, nrcpts=1, msgid=<200804291919.m3TJJZ4k001616@lctwprddb01.lifecell.biz>, proto=ESMTP, daemon=MTA, relay=lctwprddb01.lifecell.biz [127.0.0.1]
Apr 29 15:19:35 lctwprddb01 sendmail[1616]: m3TJJZ4k001616: to=ngoradia@lifecell.com, ctladdr=oracle (500/500), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30109, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m3TJJZhB001617 Message accepted for delivery)
Ivan Kartik
I need message which is after this message "Apr 29 15:19:35 lctwprddb01 sendmail[1616]: m3TJJZ4k001616: to=ngoradia@lifecell.com, ctladdr=oracle (500/500), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30109, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m3TJJZhB001617 Message accepted for delivery)" and it is related to this message or this message ID respectively.
user616124
Apr 29 15:19:35 lctwprddb01 sendmail[1616]: m3TJJZ4k001616: to=ngoradia@lifecell.com, ctladdr=oracle (500/500), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30109, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m3TJJZhB001617 Message accepted for delivery)
Apr 29 16:04:52 lctwprddb01 sendmail[1422]: m3TIP6LJ031388: to=<ngoradia@lifecell.com>, ctladdr=<oracle@lctwprddb01.lifecell.biz> (500/500), delay=01:39:46, xdelay=00:48:01, mailer=esmtp, pri=120423, relay=cluster2a.us.messagelabs.com. [216.82.249.211], dsn=4.0.0, stat=Deferred: Connection timed out with cluster2a.us.messagelabs.com.

Apr 29 16:07:36 lctwprddb01 sendmail[1619]: m3TJJZhB001617: to=<ngoradia@lifecell.com>, ctladdr=<oracle@lctwprddb01.lifecell.biz> (500/500), delay=00:48:01, xdelay=00:48:01, mailer=esmtp, pri=120425, relay=cluster2a.us.messagelabs.com. [216.82.248.44], dsn=4.0.0, stat=Deferred: Connection timed out with cluster2a.us.messagelabs.com.
Apr 29 16:07:52 lctwprddb01 sendmail[1627]: m3TILs2r031176: to=<ngoradia@lifecell.com>, ctladdr=<oracle@lctwprddb01.lifecell.biz> (500/500), delay=01:45:58, xdelay=00:48:01, mailer=esmtp, pri=120429, relay=cluster2a.us.messagelabs.com. [216.82.248.45], dsn=4.0.0, stat=Deferred: Connection timed out with cluster2a.us.messagelabs.com.
Ivan Kartik

relay=cluster2a.us.messagelabs.com. [216.82.248.44], dsn=4.0.0, stat=Deferred: Connection timed out with cluster2a.us.messagelabs.com.

That's what I was looking for. Now from this computer try execute following command:

telnet cluster2a.us.messagelabs.com 25

If you will not get following text "Escape character is '^]'." then you need to contact your network/firewall admin to allow connection from your host (lctwprddb01.lifecell.biz) to your SMTP (cluster2a.us.messagelabs.com) and port 25.

user616124
Hi you were right I was not able to do
#telnet cluster2a.us.messagelabs.com 25.
It didnt gave me results which you mentioned .
I went to my network administrator and explained him

he replied to me as:

Mail should be sent to the Exchange environment, not the Message Labs mail cluster. Additionally, for security reasons you can not just use our email servers as an external mail relay. If you tell me the IP’s of the systems that need to route this mail, I will add them to the approved list.

With his this response I passed him ipaddress of lctwprddb01 server.
Ipaddress of lctwprddb01 is 172.16.179.98.

he replied saying :

Try this –



#telnet 172.16.179.105 25

I tried above on lctwprddb01.
[root@lctwprddb01 log]# telnet 172.16.179.105 25

Trying 172.16.179.105...

Connected to lc-hqhub01.lifecell.biz (172.16.179.105).

Escape character is '^]'.

220 lc-hqhub01.lifecell.biz Microsoft ESMTP MAIL Service ready at Wed, 30 Apr 2008 10:57:57 -0400
I passed him above disply too.

Looks to me he is saying that sendmail shoulde 172.16.179.105 instead cluster2a.us.messagelabs.com .

How can i make these changes?
Ivan Kartik

OK from above posts is clear that you are using sendmail.
Now edit /etc/mail/sendmail.cf file.
Locate line with this text: "# "Smart" relay host (may be null)" and on next line add "lc-hqhub01.lifecell.biz" after "DS". So the line will be looking as following:

DSlc-hqhub01.lifecell.biz

Then restart sendmail using following command:

/etc/sendmail restart

Now your configuration is complete.

user616124
I did required changes and ran
[root@lctwprddb01 mail]# cd ..
[root@lctwprddb01 etc]# sendmail restart




Its not showing anything on screen
I am wondering it is doing anything or not?
user616124
I just did service sendmail stop and servcie senmail start .

IT WORKED !!!!!!!

I received yesterdays emails which i send for testing ..

Thanks a lot ....
Ivan Kartik
You are welcome...
1 - 17
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on May 28 2008
Added on Apr 29 2008
17 comments
3,355 views