Using Perl to utilize Mail Command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Using Perl to utilize Mail Command
# 1  
Old 02-04-2010
Using Perl to utilize Mail Command

Does anyone know a way to use the mail command in perl as a one-liner? I am trying to do something like system("mail username@gmail.com -s Tester) but the only catch is to place the period "." after using the mail command in order to complete the command. I do not want to install any other 3rd party program nor do I want to use sendmail. Does anyone know a way to do this? Thanks!
# 2  
Old 02-04-2010
Try Net::SMTP. It's part of the core distribution, and you don't need to bother around with pipes and stuff.
# 3  
Old 02-04-2010
Awesome, thanks alot. Just one more question: how can I determine what the smtphost is? I checked ENV and Set, but couldn't find anything. Is there a default for this or is this something I need to ask the System Admin about? Thanks again!

---------- Post updated at 09:59 AM ---------- Previous update was at 09:46 AM ----------

I asked the system admin, it was just mailhost. I would suggest anyone who uses this to try that one first. Thanks alot for the help!!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Understanding ZFS Snapshots - why will it utilize space ?

Hi all, I am moving to Solaris11 and is trying to understand how ZFS snapshot works. Chances upon this Oracle Blog and can't wrap my head around it. https://blogs.oracle.com/solaris/understanding-the-space-used-by-zfs-v2 Hope gurus here can shed some light . ======= ... (4 Replies)
Discussion started by: javanoob
4 Replies

2. UNIX for Advanced & Expert Users

Unable to send mail with 'mail' command

I am unable to cause the 'mail' command to send mail from my linux ubuntu 15.10 computer. File 'mail.log' typically reports Connection timed out. I issue the command: mail -s "my subject" recipient@domain.com < filenamewhere filename is a file containing my message. Specifically, the... (3 Replies)
Discussion started by: tcnm
3 Replies

3. Shell Programming and Scripting

Utilize input file in place of argument

First I apologize for my ignorance as I am very new to the world of UNIX but love it and have a huge desire to learn it. A question I have is if a Korn script utilizes/relies on an argument to run, can you add these into a file and pipe them to the script without changing anything inside the... (2 Replies)
Discussion started by: djzah
2 Replies

4. Homework & Coursework Questions

Creating a function that sends a mail using mail command

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: The function will be called m and it will allow you to send an email to someone using the mail command. The... (1 Reply)
Discussion started by: Drucian
1 Replies

5. Shell Programming and Scripting

Not able to send the mail using mail and mailx command

Hi All, I am trying to send a mail from linux server but could'nt able to send the mail. I tried the below syntax's so far but no luck. mail -s “Hello world” abc@xyz.com < /usr/g/txt.log cat "txt.log" | mailx -s "Hello world" abc@xyz.com mailx -s “Hello world” abc@xyz.com <... (2 Replies)
Discussion started by: scriptscript
2 Replies

6. Solaris

Regarding cpu & memory utilize

Dear all, i am not getting the exact things what i am expecting from these commands . just clarify this things , 1. cpu utilization (min)% 2.peak load cpu utilization (max) % 3.cpu utilization(avg) 4. peak disk busy % 5. peak kb read 6.peak kb write 7.free memory for... (3 Replies)
Discussion started by: masthan25
3 Replies

7. Solaris

identify the mail server for mail command

Hi , I am new to unix , i am using the mail and mailx command to send the mail .How come i will know the my mail command using which server as mail box.. Please help me .. Thanks in advance (1 Reply)
Discussion started by: julirani
1 Replies

8. Solaris

How to utilize the 2nd hard disk space in x86 solaris 5.10

I have 2 hard disks ,one hard disk(40gb) completely for windows Os,and the other(120gb) for solaris Os. In the second hard disk.I have utilised around 10gb for the solaris installation and also partitioned with the available 10gb space for the solaris x86 OS. Now i need to utilise the... (8 Replies)
Discussion started by: jayaprakash
8 Replies

9. Shell Programming and Scripting

ksch script to utilize UNIDATA count command.

I am working on a ksh script to pattern match on a file and then initialize a unidata session to allow me to see if the file is cleared or not. The problem i am having is that the code works but it executes a new unidata session multiple times. I would build a paragraph but new WWW files are... (0 Replies)
Discussion started by: pagink
0 Replies

10. Shell Programming and Scripting

E-Mail from command line for UNIX and Perl??

Hi Is there any way to use UNIX and Perl to automate sending e-mail. I got a dynamic changing file that send out to people in my mailing list and want to experinment to see if Perl and UNIX can send it out for me when the content is change. I found a Perl source code but dont really know how to... (4 Replies)
Discussion started by: jy2728
4 Replies
Login or Register to Ask a Question