HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Server Operation (http://www.howtoforge.com/forums/forumdisplay.php?f=5)
-   -   The Perfect Setup - Debian Etch: smart_host (http://www.howtoforge.com/forums/showthread.php?t=14172)

bidevi 20th July 2007 12:55

The Perfect Setup - Debian Etch: smart_host
 
On Fedora Core 6 in /etc/mail/sendmail.mc I configured Sendmail's smart_host, so visitors of my site practically use my ISP's smtp server to send me their message filling in a web form. For configuration I used instructions provided by: http://www.go2linux.org/node/35.

Now I have Postfix, because I've set up Debian Etch following the guide lines of The Perfect Setup instructions.

Can anyone tell me how to do a smart-host like configuration now, so my visitors can keep on doing the same thing: send me mail using a web form on my site?

bidevi 20th July 2007 21:26

No reax, so question 2: is there a form mail for Postfix?
 
My ISP is 1&1 in Germany and they have strange habits. For example, I cannot get a PHP mail form script working. This is what 1&1 says about it: The only FormMail script you can use on the 1&1 servers is the NMS FormMail.pl. This can be downloaded from http://nms-cgi.sourceforge.net/scripts.shtml. (See: http://faq.1and1.com/scripting_langu...ned/index.html. As a matter of fact, FormMail.pl works with Sendmail, not Postfix.

Nevertheless, on Fedora Core 6 I did get form mail working with a perl script that addresses Sendmail. The script was written by Kristina Pfaff-Harris and it can be found here: http://tesol.net/scripts/AutoCGIMail/.

For the Perfect Etch Setup on my Debian machine I installed Postfix instead of Sendmail. Kristina does not offer her script for Postfix.

My question: can anyone recommend a good Postfix mail form script?

falko 21st July 2007 18:20

Quote:

Originally Posted by bidevi
Now I have Postfix, because I've set up Debian Etch following the guide lines of The Perfect Setup instructions.

Can anyone tell me how to do a smart-host like configuration now, so my visitors can keep on doing the same thing: send me mail using a web form on my site?

Take a look at the Smart Host section on http://www.fredshack.com/docs/postfix.html

Quote:

My ISP is 1&1 in Germany and they have strange habits. For example, I cannot get a PHP mail form script working. This is what 1&1 says about it: The only FormMail script you can use on the 1&1 servers is the NMS FormMail.pl. This can be downloaded from http://nms-cgi.sourceforge.net/scripts.shtml. (See: http://faq.1and1.com/scripting_langu...ned/index.html. As a matter of fact, FormMail.pl works with Sendmail, not Postfix.

Nevertheless, on Fedora Core 6 I did get form mail working with a perl script that addresses Sendmail. The script was written by Kristina Pfaff-Harris and it can be found here: http://tesol.net/scripts/AutoCGIMail/.

For the Perfect Etch Setup on my Debian machine I installed Postfix instead of Sendmail. Kristina does not offer her script for Postfix.

My question: can anyone recommend a good Postfix mail form script?
Postfix is compatible to Sendmail, so I don't know why it shouldn't work with Postfix. Postfix even comes with a binary called sendmail to guarantee Sendmail compatibility.

bidevi 23rd July 2007 00:21

So can I use Postfix just like Sendmail?
 
Thank you, Falko, for your response.

If Postfix works like Sendmail, does that mean that I can change Sendmail to Postfix and everything works fine?

I've tried that before. On my FC6 machine with Sendmail I've got a perl script with content as displayed below. After configuring smarthost in Postfix on my Debian machine I tried this same perl script after changing every instance of Sendmail in the cgi file to Postfix. I didn't really believe it would work, but if experts tell me Postfix behaves like Sendmail, I assume that scripts written for Sendmail work with Postscript. It didn't.

Below is a part of the cgi file where I changed every instance of sendmail to postfix (I didn't change it below and I tried the script also in its original form, but nothing worked):

#!/usr/bin/perl

# This email script generated by AutoCGIMail v1.2
# by Kristina Pfaff-Harris (http://www.tesol.net/scripts/)
#
# If you're having problems getting this to work, try putting
# $debugging = 1; on the next line.

$path_to_sendmail = "/usr/sbin/sendmail";
$email_field = "01Uw_e-mailadres";
$use_autoresponse = "Yes";
$autoresponse_message1 = "Geachte ";
$autoresponse_message2 = ",

(et cetera)

But it's all not that simple. So how do I adapt things in such a way that my perl scripts, working well in Sendmail, keep on working in Postfix?

(Later this week I'll configure the apps again and try instructions at http://www.fredshack.com/docs/postfix.html)

falko 23rd July 2007 13:37

Quote:

Originally Posted by bidevi
#!/usr/bin/perl

# This email script generated by AutoCGIMail v1.2
# by Kristina Pfaff-Harris (http://www.tesol.net/scripts/)
#
# If you're having problems getting this to work, try putting
# $debugging = 1; on the next line.

$path_to_sendmail = "/usr/sbin/sendmail";
$email_field = "01Uw_e-mailadres";
$use_autoresponse = "Yes";
$autoresponse_message1 = "Geachte ";
$autoresponse_message2 = ",

(et cetera)


All you have to change is the path to sendmail. You can find out the path by running
Code:

which sendmail

bidevi 23rd July 2007 14:24

Another try
 
During my experiments to get to know Debian and ISPConfig I always login as root. If something goes really wrong, I just reinstall the OS.

In Terminal:
# which sendmail
/usr/sbin/sendmail

No luck: that's what is in my cgi script already.

I'll describe the working situation first.

SENDMAIL

Let's assume you own domain happydomain.com. Let's also assume that your ISP's outgoing mail server uses this smtp code: smtp.nicehost.com, and your email address is blah@nicehost.com.
Furthermore
user name: blahusername
password: blahpassword

Say you need an smtp server to send email through mail forms on your web page, hosted on your own server at home. If you want to use your ISP's smtp server you can do this with the help of smarthost.

The following configuration works flawlessly in Fedora Core 6 (FC6) with Sendmail:

In /etc/mail/sendmail.mc add these lines:

dnl MASQUERADE_AS('your.domain')dnl
define(`SMART_HOST',`your.smtp.server')dnl
FEATURE(`masquerade_envelope')dnl
FEATURE(genericstable, `hash -o /etc/mail/genericstable')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain')dnl

These lines have to be modified to look like:

dnl MASQUERADE_AS('happydomain.com')dnl
define(`SMART_HOST',`smtp.nicehost.com')dnl
FEATURE(`masquerade_envelope')dnl
FEATURE(genericstable, `hash -o /etc/mail/genericstable')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain')dnl

In order to authenticate to the email server of your ISP make sure to have the following line in the file /etc/mail/sendmail.mc:

FEATURE(`authinfo', `hash /etc/mail/authinfo')

and create this file:

/etc/mail/authinfo

with this inside:

AuthInfo:your.smtp.server "U:user@your.smtp.server" "I:user" "P: passwd" "M:LOGIN PLAIN"

where you modify this line to look like this:

AuthInfo:smtp.nicehost.com "U:user@smtp.nicehost.com" "I:blahusername" "P:blahpassword" "M:LOGIN PLAIN"

Now generate the sendmail.cf file using this command:
make -C /etc/mail

Create a file named: /etc/mail/genericstable
with this inside it: root user@domain.com
(do not replace user@domain.com with your own data)

Execute this:
makemap hash /etc/mail/genericstable < /etc/mail/genericstable

and run:

makemap hash /etc/mail/authinfo < /etc/mail/authinfo

and make authinfo readable only by root:
chmod 600 /etc/mail/authinfo

This did it for me. I can send emails using my ISP's outgoing mail server with my FC6 server.


POSTFIX

I have not been able, so far, to find instructions on the web how to configure Postfix in the same manner as Sendmail. Alright, I have modified a line in /etc/postfix/main.cf to look like: relayhost = smtp.nicehost.com, but my web form didn't execute anything besides telling me the mail was sent, which wasn't the case.

I'm not amazed that it doesn't work because no authentication method was set up.

Any suggestions how to get it working for Postfix?

bidevi 23rd July 2007 16:05

PHP mail form in Fedora Core 6: yes
 
Earlier I wrote:

My ISP is 1&1 in Germany and they have strange habits. For example, I cannot get a PHP mail form script working (...)

I have just tried the form on my FC6 server and the PHP mail form worked fine (the mail was sent and received), so what I've stated earlier about 1&1 is wrong.

The mail form did not work on Debian Etch (The Perfect Setup), which is on the same LAN behind the same router. Neither did it work on my Mac OS X (PPC) Apache server.

I wonder why that is. Could it be that PHP on my FC6 machine has different PHP modules installed which are needed for PHP mail forms?

Does anybody have a clue where to look for clues?

falko 24th July 2007 14:07

Quote:

Originally Posted by bidevi
POSTFIX

I have not been able, so far, to find instructions on the web how to configure Postfix in the same manner as Sendmail. Alright, I have modified a line in /etc/postfix/main.cf to look like: relayhost = smtp.nicehost.com, but my web form didn't execute anything besides telling me the mail was sent, which wasn't the case.

I'm not amazed that it doesn't work because no authentication method was set up.

Any suggestions how to get it working for Postfix?

Take a look here: http://www.howtoforge.com/postfix_re...her_mailserver

bidevi 28th July 2007 16:17

Probably solved
 
My postfix/sendmail problems seemed to be caused by the fact that I had 2 PCs running next to each other. When I switched the first one off, sendmail started working OK on PC #2, probably because port 25 was now free. I'll check postfix later.

bidevi 30th July 2007 10:23

How long should one keep on solving a problem?
 
OK, so this is what I've got today:

1. Debian Etch installed (Perfect Setup) on my trial server #2
2. Postfix modified according to these guidelines: http://www.howtoforge.com/postfix_re...her_mailserver
3. My mail form cgi script points to: /usr/sbin/sendmail
4. When I send mail through my web page I get an OK but no mail is ever sent (again!)
5. Server #1 is switched off so there is no interference

When server #1 is doing the job everything is going well with sendmail on FC6, so I assume there is nothing wrong with my mail form.

How long should one keep on solving a problem which shouldn't exist?

Thanx for any help anyway.


All times are GMT +2. The time now is 10:54.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.