XTStrike
07-09-2001, 04:38 PM
Hi, im trying to use perl to inject a message into the qmail outbound queue, with little/no success, has anobody done it before? or can help? I would be forever in your debt.
PLEASE ASAP - if you have a friend get them involved, im soo desperate you wouldnt believe it.
Thanx
qslack
07-09-2001, 04:48 PM
Can you use /var/qmail/bin/qmail-inject? It works just like sendmail's /usr/sbin/sendmail, where you give it the headers then an EOF, and it sends the message.
XTStrike
07-09-2001, 04:59 PM
hi, qslack, i have the following, any idea whats wrong ?
ive tried various different layouts aswell as this
#!/usr/bin/perl
open (MAIL, "|/var/qmail/bin/sendmail -t");
print MAIL "To: XTStrike\@aol.com, DKoesterich\@BlackOnyxLLC.com\n";
print MAIL "From: Testing\@Testing.com";
print MAIL "Subject: Test Email With QMail\n\n";
print MAIL "Testing";
close(MAIL);
print "Content-type: text/html\n\n";
print "Email Sent";
exit;
XTStrike
07-09-2001, 05:02 PM
also tried :
#!/usr/bin/perl
open (MAIL, "|/var/qmail/bin/qmail-inject");
print MAIL "To: XTStrike\@aol.com, DKoesterich\@BlackOnyxLLC.com\n";
print MAIL "From: Testing\@Testing.com";
print MAIL "Subject: Test Email With QMail\n\n";
print MAIL "Testing";
close(MAIL);
print "Content-type: text/html\n\n";
print "Email Sent";
exit;
XTStrike
07-09-2001, 05:15 PM
I thought i would praise in public.
BUT - ive just been slaving over that code for 3 hours and "qslack" just solved it for me.
MAY I PUBLICLY PRIASE THIS GUY - FROM THE BOTTOM OF MY HEART "THANK YOU"
QSLACK - YOU ARE AMAZING
qslack
07-09-2001, 05:20 PM
:cool: :) :D Happy to help.
(SH)Saeed
07-09-2001, 05:39 PM
Why not put the solution in public so others can learn from this as well?
qslack
07-09-2001, 05:42 PM
#!/usr/bin/perl
open (MAIL, "|/var/qmail/bin/qmail-inject");
print MAIL "To: XTStrike\@aol.com, DKoesterich\@BlackOnyxLLC.com\n";
print MAIL "From: Testing\@Testing.com\n";
print MAIL "Subject: Test Email With QMail\n";
print MAIL "Testing";
close(MAIL);
print "Content-type: text/html\n\n";
print "Email Sent";
exit;
I think that was the solution.
XTStrike
07-09-2001, 05:42 PM
lol, yeah good point, forgot to do that, i was so happy he solved it for me !!
correct code is as follows, the main issue was simply carriage returns, simple maybe to someone as experienced as qslack, but to a mere beginner like myself its a critical mistake, weing the difference between working and not working:
#!/usr/bin/perl
open (MAIL, "|/var/qmail/bin/qmail-inject\n");
print MAIL "To: XTStrike\@aol.com, DKoesterich\@BlackOnyxLLC.com\n";
print MAIL "From: Testing\@Testing.com\n";
print MAIL "Subject: Test Email With QMail\n";
print MAIL "Testing\n";
close(MAIL);
print "Content-type: text/html\n\n";
print "Email Sent";
exit;
(SH)Saeed
07-09-2001, 08:01 PM
Heheh, I noticed that in your previous posts. When you've been coding Perl for a few years, you automaticly end the line with those things without even thinking about it.
Anyways,.. I'm glad you got it working.
Oops.. forgot a very important thing -->> :D