• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Running a command as a user(perl)

d4mo

Senior member
I'm making an email script. I'm using perl to do a couple of things and then send an email using ssmtp. The problem is when I run the ssmtp command I don't think it's running as me. How can I get it to run as me(or any user for that matter)?

I'm using system("ssmtp email@email.com < asdfsda.txt");

When perl runs that what user is technically running the ssmtp command? I assume it's not getting my user config and thats why it's not going through.
 
I would expect that Perl is working under your username. Try the following at a terminal to find out for sure:

perl -e "print `whoami`"

There are three ways to run a system command in Perl: the way you did it, the way I just did above, and open with a pipe. I suggest you try:

open(IN, "ssmtp email@email.com < asdfsda.txt |");

and see what the output is, if any.
 
Thats really weird. It does run as me. But here's the thing. I did a ssmtp -v(verbose) and it claims the message was sent right. Everything is identical(output) if I do it from the from the shell or from through the perl program, only when I do it through perl the email never gets to my inbox.
 
Yeah, I could use stuff from CPAN but now I just want to know why it doesn't work. I installed mailx and the same thing happens :S
 
Back
Top