mail from unix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting mail from unix
# 1  
Old 04-22-2008
mail from unix

hi
i looked at different threads on how to send mail from unix. but i want to ask how can i send mail when my unix server is only connected to mail server this i know cause i can ping it to that server.
how can send mail with help of that mail server ? i do have mail id on that server.
i know perl & shell any ideas will be helpful.
# 2  
Old 04-22-2008
The question is a bit under-specific. Does sending mail not work at the moment, or do you lack the software to send mail? Is installing a simple mail server out of the question? Sendmail, Postfix, Exim etc. are all possible to configure to simply relay to a "smarthost", in most cases with a minimal effort. Or with a simple Perl script you could talk SMTP directly to the mail server, is that what you want?
# 3  
Old 04-23-2008
thanx for reply

Quote:
with a simple Perl script you could talk SMTP directly to the mail server,
sorry for not being specific ...

need some help for this
# 4  
Old 04-23-2008
Hmm, you're still not very specific.

Net::SMTP - Simple Mail Transfer Protocol Client - search.cpan.org

Quote:
This documentation assumes that you are familiar with the concepts of the SMTP protocol described in RFC821.
The RFC is fairly technical but there's a metric gajillion tutorials in Google. For getting started you really only need to understand EHLO, MAIL FROM, RCPT TO, and DATA. Once you grok those the next step is probably actually to tackle RFC2822 and in particular to understand how MIME fits into the picture. (Go on, Google for those. And those others.)

Last edited by era; 04-23-2008 at 09:16 AM.. Reason: Nudge to Google with a link, even
# 5  
Old 04-23-2008
thanx for the link i will read it and in case of any doubts i will get back

to be specific here is what i want to do :

i have written a scripts which compiles newly created programs after every 2 hr ( cron job ) which generates 2-3 log files. every time someone has to goto actual log file to see if everything went well. instead of this i want same program to generate mail and send it to specific mail id ( generating mail is not a problem ) on desktop i can do this with mailx command and it works perfectly but in my office as unix servers are not connected to network i can not use "mailx" but its connected to mail server.

so i want to write a script which will talk to mail server, which will send mail to specific person.
# 6  
Old 04-23-2008
Still sounds like you should simply install mailx and Postfix and configure it to only talk to your mail server. It can work in an intranet just fine (and indeed, must).
# 7  
Old 05-01-2008
hey era i used EasyMail to send mail ...which works @ my workplace

but problem is that that script hangs when i try to send mails using my gmail account. i am using smtp server address [ which i get after pinging smtp.gmail.com ] and port is 465. but nothing happen.. script just hangs

here is the link for EasyMail EasyMail - Perl Send Mail Interface - search.cpan.org

here is my code ...
Code:
C:\Documents and Settings\Zedex>ping smtp.gmail.com

Pinging gmail-smtp.l.google.com [209.85.147.111] with 32 bytes of data:

Reply from 209.85.147.111: bytes=32 time=261ms TTL=236
Reply from 209.85.147.111: bytes=32 time=261ms TTL=236

#! /usr/bin/perl -w
use EasyMail ;
use strict ; 

my $mail = {
             'sender_type'  => "SMTPAUTHLOGIN" ,
	     'smtp_host'    => "209.85.147.111" ,
	     'smtp_port'    => "465",
	     'smtp_usr'     => "myid\@gmail.com",
	     'smtp_pass'    => "pass",
	     'type'         => "plain",
	     'subject'      => "Test Mail",
	     'body'         => "This is a test message from unix sent with EasyMail",
	     'from'         => "myid\@gmail.com",
	     'to'           => "testid\@abc.com",
	     'cc'           => "test1\@abc.com",
	     'src_encoding' => "NONE",
	     'dst'          => "un"
	  };
print "Message formed now sending ...\n" ;
EasyMail::sendmail($mail) ;
print "Mail sent ...\n" ;
if ( defined($mail->{'error'})){
    print "Mail sending failed....\n" ;
}

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Client was not authenticated to send anonymous mail during MAIL FROM (in reply to MAIL FROM comm

I am having trouble getting mail to work on a red hat server. At first I was getting this message. Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to :25: Connection refused Then added the port to my firewall. Then I temporarily turned off selinux. I then copied this file... (1 Reply)
Discussion started by: cokedude
1 Replies

2. UNIX for Advanced & Expert Users

How can I send a mail from my outlook or other mail accounts to UNIX server?

Hi all, I want to send a mail for my business needs from outlook account to an unix server (HP-UX) but I don't send any mail. While I can send from the unix server to my outlook account, I can't send from outlook to unix. How can I achieve this ? How can I send a mail from my outlook or other... (2 Replies)
Discussion started by: igelegin
2 Replies

3. UNIX for Advanced & Expert Users

need to configure mail setting to send mail to outlook mail server

i have sun machines having solaris 9 & 10 OS . Now i need to send mail from the machines to my outlook account . I have the ip adress of OUTLOOK mail server. Now what are the setting i need to do in solaris machines so that i can use mailx or sendmail. actually i am trying to automate the high... (2 Replies)
Discussion started by: amitranjansahu
2 Replies

4. HP-UX

[Solved] How do I configure Unix Mail Server to use another Mail Exchange Server

We have configured our mail unix server and can send out emails automatically from applications running on unix to different people in our company as well as outside our company. However there is an outside client who is not receiving these emails because the settings on their mail server cannot... (4 Replies)
Discussion started by: Tenyhwa
4 Replies

5. UNIX for Advanced & Expert Users

How to relay mail to mail server from Unix ?

Hi, I need to send email notifications from Unix/Linux box to users using mailx. In these Unix/Linux boxes mail is not configured however we are having mail server configured in our LAN. Could you please provide instructions to configure relay in these boxes so that we can relay our mails... (3 Replies)
Discussion started by: sourabhsharma
3 Replies

6. UNIX for Dummies Questions & Answers

Unix mail to personal mail, Strange behavour

Hi. I am running a script on solaris 10 and mailing it to my personal email. the script is ran as user xxx, And i have edited the crontab for user xxx to run the script and mail it to my email account. /network_check.sh | /usr/bin/mailx -s "Network Test" k454@hotmail.com the sript... (2 Replies)
Discussion started by: k00061804
2 Replies

7. Shell Programming and Scripting

Mail attachment with unix mail

Hi Could someone help me with the details on how to send an attachment through mail in unix. I have an html file in my unix machine and I want this to be send to some mail id, plese help with the steps. Regards Ajay (2 Replies)
Discussion started by: ajaykumarboyana
2 Replies

8. UNIX for Dummies Questions & Answers

UNIX to find the unix mail id

Hi all, Need you assistace. is there any command available in UNIX to find the unix mail id ? tried using 'mail' but no use kindly helpe me out. Thanks in advance. manas (2 Replies)
Discussion started by: manas6
2 Replies

9. UNIX for Dummies Questions & Answers

I am not able to send mail form unix to other mail accounts.

Using Mailx command i.e mailx -s "subject" chinni@hotmail.com < \tmp\chin this command executed sucessfully but not able to receive the mail in chinni@hotmail.com please help. (1 Reply)
Discussion started by: chinnigd
1 Replies

10. UNIX for Dummies Questions & Answers

can not send mail from unix server to company/yahoo mail

hi, Gurus, I need some help with sending mail out from my UNIX server: It is running Solaris 2.6 and the sendmail version is 8.8. Output of :/usr/lib/sendmail -d0.1 -bt < /dev/null Version 8.8.8+Sun Compiled with: LOG MATCHGECOS MIME7TO8 MIME8TO7 NAMED_BIND NDBM NETINET ... (5 Replies)
Discussion started by: b5fnpct
5 Replies
Login or Register to Ask a Question