Koozali.org: home of the SME Server

Obsolete Releases => SME Server 7.x => Topic started by: swissis on June 24, 2007, 10:01:14 PM

Title: qmail using anonymous@myplace.com to send mail
Post by: swissis on June 24, 2007, 10:01:14 PM
Hi,

I run a database with planning data and am sending some emails every day on who has to do what en when.
I have written a php page with the intelligence for that. In this php page is the sendmail command.

I then use a cron job to execute the php page and most of the mail is send correct.
The problem is that the sender of the mail is anonymous@myplace.com and it is bounced by some ISP's
How do i fix this?
Title: Re: qmail using anonymous@myplace.com to send mail
Post by: Stefano on June 24, 2007, 11:08:10 PM
Quote from: "swissis"
Hi,

I run a database with planning data and am sending some emails every day on who has to do what en when.
I have written a php page with the intelligence for that. In this php page is the sendmail command.

I then use a cron job to execute the php page and most of the mail is send correct.
The problem is that the sender of the mail is anonymous@myplace.com and it is bounced by some ISP's
How do i fix this?


create an entry in a user's crontab..

pay attention to php page file permission.

HTH

ciao
Stefano
Title: qmail using anonymous@myplace.com to send mail
Post by: swissis on June 25, 2007, 07:38:12 AM
Can you please show me how this is done?

I know only the crontab command and then press insert and so on.

And what kind of attention should i pay to the php file?
Title: qmail using anonymous@myplace.com to send mail
Post by: Stefano on June 25, 2007, 09:28:57 AM
Quote from: "swissis"
Can you please show me how this is done?

I know only the crontab command and then press insert and so on.

And what kind of attention should i pay to the php file?


choose a user and change his shell (man chsh)

log in console with user's account and do
Code: [Select]

crontab -e


insert a line calling your php page..

your php page must be executable from your user

HTH

Ciao

Stefano
Title: qmail using anonymous@myplace.com to send mail
Post by: swissis on June 25, 2007, 11:52:22 AM
Hi Stefano,

What do you mean by

Quote
choose a user and change his shell (man chsh)


I looked up the Manual about this but i'm a novice to this.
What is the shell good for?
Title: qmail using anonymous@myplace.com to send mail
Post by: Stefano on June 25, 2007, 12:13:06 PM
Quote from: "swissis"
Hi Stefano,

What do you mean by

Quote
choose a user and change his shell (man chsh)


I looked up the Manual about this but i'm a novice to this.
What is the shell good for?


Hi..

if you are asking me such a thing, it's not a good choice what I was talking about..

so, let's try another way: can't you set the FROM address in your php page?

Ciao

Stefano
Title: qmail using anonymous@myplace.com to send mail
Post by: Confucius on June 25, 2007, 12:19:09 PM
Stefano,

From what I read he has 1 database that does all with 1 PHP script. The things your are referring too are about each user issues. While I have the impression it's a global script that only has problems with the mail-address.
Title: qmail using anonymous@myplace.com to send mail
Post by: swissis on June 25, 2007, 12:20:11 PM
Dummy
Title: qmail using anonymous@myplace.com to send mail
Post by: swissis on June 25, 2007, 12:20:48 PM
Hi, thats the strange thing i did set the FROM part

I have a table in my-sql where all the data is in the code above this i make a connection to the database and collect the info i need to send the mails.

Code: [Select]

       if ($email != '') {
        $msg = "Beste $voorn, je hebt de komende dagen een bijeenkomst\n\n";
        $msg .= "Wat   : $naam\n";
        $msg .= "Datum : $datum\n";
        $msg .= "Tijd  : $tijd\n";
        $msg .= "Plaats: $plaats\n";
        $msg .= "Ruimte: $ruimte\n\n";
        $msg .= "Opm.  : $opmerk\n\n";
        $msg .= "Mensen ik ben aan het testen met dit systeem.\n";
            $msg .= "Niet boos of verdrietig worden als er een mailtje dubbel komt ;-) \n";
            $msg .= "Dit bericht wordt 2 dagen van te voren verzonden, laat ff weten of dat goed is.";
       
        $receipient = $email;


        $subject = "Op $datum $tijd, $naam (dit bericht is automatisch verzonden)";

        $mailheaders = "From: info@myplace.nl <> \n";
        $mailheaders .= "Reply-To: me@myplace.nl\n\n";

        mail($receipient, $subject, $msg, $mailheaders);

        $tempnaam .= ", " . $naamcompl;
        $rows = $rows + 1;

        //echo($msg . "<br>");

       
        } //if


I the qmail log is this strange enough

Code: [Select]

2007-06-21 18:00:01.986275500 new msg 1689654
2007-06-21 18:00:01.986280500 info msg 1689654: bytes 323 from <anonymous@xxxxxxx.com> qp 32111 uid 102
2007-06-21 18:00:02.109099500 starting delivery 93875: msg 1689654 to remote xxxxxx@xxxxxxx.nl
2007-06-21 18:00:02.109105500 status: local 0/10 remote 3/20
2007-06-21 18:00:02.189665500 new msg 1690364
2007-06-21 18:00:02.189671500 info msg 1690364: bytes 651 from <anonymous@xxxxxx.com> qp 32117 uid 102
2007-06-21 18:00:02.200190500 starting delivery 93876: msg 1690364 to remote xxxxx@xxxxx.nl
2007-06-21 18:00:02.200196500 status: local 0/10 remote 4/20
Title: qmail using anonymous@myplace.com to send mail
Post by: swissis on June 25, 2007, 12:22:49 PM
Confucius, you are right.

I used to work for many years but some ISP's are rejecting my mails now
Title: qmail using anonymous@myplace.com to send mail
Post by: Confucius on June 25, 2007, 12:32:01 PM
You tried to change the From: address already to a full name. You have nothing between the < > now. Might be that this is the reason for not being able to see who it's from.
Title: qmail using anonymous@myplace.com to send mail
Post by: swissis on June 25, 2007, 12:38:51 PM
Right,

So you mean i have to change
Code: [Select]

$mailheaders = "From: info@myplace.nl <> \n";
$mailheaders .= "Reply-To: me@myplace.nl\n\n";

mail($receipient, $subject, $msg, $mailheaders);


into

Code: [Select]

$mailheaders = "From: <info@myplace.nl> \n";
$mailheaders .= "Reply-To: me@myplace.nl\n\n";

mail($receipient, $subject, $msg, $mailheaders);
Title: qmail using anonymous@myplace.com to send mail
Post by: Confucius on June 25, 2007, 12:56:08 PM
No, more like :

Code: [Select]
$mailheaders = "From: info@myplace.nl <info@myplace.nl> \n";
Title: qmail using anonymous@myplace.com to send mail
Post by: swissis on June 25, 2007, 01:00:03 PM
okee, i just tried it but without effect.

In the qmail log is still

2007-06-25 13:02:58.863278500 new msg 1690223
2007-06-25 13:02:58.863284500 info msg 1690223: bytes 700 from <anonymous@xxxxxx.com> qp 15760 uid 102
2007-06-25 13:02:58.870144500 starting delivery 99382: msg 1690223 to remote m.xxxxxx@xxxx.nl
2007-06-25 13:02:58.870150500 status: local 0/10 remote 1/20
Title: qmail using anonymous@myplace.com to send mail
Post by: Confucius on June 25, 2007, 01:12:43 PM
Weird... tired it myself... send out as root@myspace.nl

Checking for reasons...

info@myspace.nl is an existing/known alias ??
Title: qmail using anonymous@myplace.com to send mail
Post by: Confucius on June 25, 2007, 01:20:48 PM
OK... might be a vital change

Code: [Select]
$mailheaders = "From: info@myspace.nl <info@myspace.nl> \n";
$mailheaders .= "Reply-To: me@myspace.nl\n";
$mailheaders .= "Return-Path: me@myspace.nl\n\n";


instead of

Code: [Select]
$mailheaders = "From: info@myspace.nl <info@myspace.nl> \n";
$mailheaders .= "Reply-To: me@myspace.nl\n\n";
Title: qmail using anonymous@myplace.com to send mail
Post by: swissis on June 25, 2007, 01:31:27 PM
Yes i created one at Pseudonyms

info@myplace.nl     postmaster_sow     Modify     Remove
mailer-daemon           Administrator              Modify    

Don't you think i should change the  user owning the cronjob.

Now this is root i think. I open a console window with PUTTY and log in with root.
When i give the command

crontab -l i see this line

0 18 * * * /bin/reminder.sh

In reminder.sh is this

Code: [Select]

reminder.sh   [B---]  6 L:[  1+ 6   7/  8] *(194 / 195b)= .  10 0x0A
#!/bin/bash
# SME 7.0 script 1.0
# Door Marcello
# Script om een php script uit te voeren
lynx -dump http://server9/sow/mailtedoen.php
lynx -dump http://server9/sow/mailmeeting.php
exit 0
Title: qmail using anonymous@myplace.com to send mail
Post by: Confucius on June 25, 2007, 01:34:09 PM
why not use the command

Code: [Select]
php /bin/yourscript.php

?
Title: qmail using anonymous@myplace.com to send mail
Post by: swissis on June 25, 2007, 01:42:37 PM
Yes that works also. Now it says in the qmail log

2007-06-25 13:39:13.230049500 new msg 1690235
2007-06-25 13:39:13.230054500 info msg 1690235: bytes 698 from <root@xxxxxx.com> qp 16006 uid 0
2007-06-25 13:39:13.238997500 starting delivery 99419: msg 1690235 to remote m.xxxx@xxxxx.nl
2007-06-25 13:39:13.239003500 status: local 0/10 remote 1/20
Title: qmail using anonymous@myplace.com to send mail
Post by: Confucius on June 25, 2007, 01:44:32 PM
Great. Another problem solved.

It doesn't surprise me 1 bit. ISP's check more and more for the validity of mail and with good reason...

Fijne dag nog.
Title: qmail using anonymous@myplace.com to send mail
Post by: swissis on June 25, 2007, 01:47:48 PM
One last thing,

What would i have to do to have the mails send by another user with a different pseudonym or email adres?

Groeten met handen en voeten terug. (ik heb nog ff zitten denken om de lengte- en breedtegraden in google earth op te zoeken)
Title: qmail using anonymous@myplace.com to send mail
Post by: Confucius on June 25, 2007, 01:52:32 PM
When I use the command line "php /bin/scriptname.php" and replace all names in front of the @ I can send out as anybody I want. That includes non-exsiting names like no-reply@myspace.nl

It goes ok for me. But have to admit, I'm not using several accounts to see the arrival, only using 1 address.