Welcome to WebmasterWorld Guest from 54.242.193.41

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

Help in Sendmail / Perl script!

Sendmail Perl Script

     

MatiasXR3

1:17 pm on Aug 17, 2004 (gmt 0)

Inactive Member
Account Expired

 
 


Hi!, i'm Matias from Argentina (Sorry for my language!), i'm trying to modify a perl script that uses variables and send it trought sendmail.

I can't use variables like:

$to = "peter@example.com"

because i have to put an "\" before the "@" like:

$to = "peter@example.com"
well... my problem is:

i can't use it dynamically because i don't know how modify the string "peter@example...." and change it to "peter\@example..." (the unique way that sendmail let me send mail! )...

can you help me!?

I'm waiting your help here or matias@example.com.ar
-----------------The script i'm using is like-----
$from="prohosthosting@example.com";
$to="matias@example.com.ar";
$subject="Sending myself a test e-mail!";
$sendmailpath="/usr/sbin/sendmail";

open (SENDMAIL, " $sendmailpath -t");
print SENDMAIL "Subject: $subject\n";
print SENDMAIL "From: $from\n";
print SENDMAIL "To: $to\n\n";
print SENDMAIL "Test e-mail.\n\n";
print SENDMAIL "- finish";
close (SENDMAIL);
-------------------------------------------------
Bye!

[edited by: Brett_Tabke at 1:29 pm (utc) on Aug. 17, 2004]

7:34 pm on Aug 17, 2004 (gmt 0)

Preferred Member

10+ Year Member

joined:Dec 19, 2000
posts:366
votes: 0


> $to = "peter@example.com"
> modify the string "peter@example...." and change it to "peter\@example..."

I didn't test it but I think the line below should do it

$to =~ s/\@/\\@/;