Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Simple php / sendmail question....
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on Sparc
View previous topic :: View next topic  
Author Message
marky9074
Apprentice
Apprentice


Joined: 24 Sep 2004
Posts: 196
Location: UK

PostPosted: Tue Apr 05, 2005 5:04 pm    Post subject: Simple php / sendmail question.... Reply with quote

Hi there, simple question I think.

I have recently swapped over to running my sites from my own Ultra 60 setup at home, but I do not have any mail server set up (dont need it). I have just been told that my simple mail php scripts for contacts have stopped working, and assume it is because of the switch to the local server and the fact that I dont run a mail server.

I was told that the problem is that my php.ini file on my previous hosting site was set to localhost. Looking at this:

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =

I see that there is no way I can authenticate if I route mail to my normal POP3 SMTP server.

I see that I have ssmtp installed and someone suggested that if I emerge sendmail it will work 'out of the box', but I am not so sure. Everything I read suggests that I have to set it up so that it uses an existing mail account to send, like for example my POP3 account. But when I was using free web space this worked just fine using their mail server and a simple php form script for a contact form.

Can anyone suggest a solution....

Cheers,

Mark
Back to top
View user's profile Send private message
riposte
n00b
n00b


Joined: 17 Nov 2003
Posts: 69
Location: New Zealand

PostPosted: Wed Apr 06, 2005 5:41 am    Post subject: Reply with quote

There are better qualified guys than me here to help you but here goes:

You shouldnt need to use your "normal" ( isp's?) smtp server the one already on your U60 should do the job.

Try:

Code:
echo test|ssmtp -s test someone@somedomain.com


To see if ssmtp is working.

If not, review /etc/ssmtp/ssmtp.conf and check port number is 25 etc. Then start or restart the server ( /etc/init.d/ssmtp start ?)
If it is working, uncomment the sendmail_path in your php.ini file and add /usr/sbin/sendmail.
I think that if ssmtp is installed it is aliased as "sendmail" through a symlink so this should work.

HTH
Back to top
View user's profile Send private message
marky9074
Apprentice
Apprentice


Joined: 24 Sep 2004
Posts: 196
Location: UK

PostPosted: Wed Apr 06, 2005 9:26 am    Post subject: Reply with quote

Looking at the ssmtp.conf it still needs to show where the mail hub is etc, so still routing through my ISP etc.. also my ISP authenticates on the send side so I need somehow to submit my username and password, and this doesnt seem to allow it...

I have been playing with sendmail and seem to have got it half working. I followed these instructions:

http://cri.ch/linux/docs/sk0009.html

Looking at the logs it appears to have connected with the SMTP server but failed to authenicate. I have mailed my ISP to see if they can help....

Mark
Back to top
View user's profile Send private message
riposte
n00b
n00b


Joined: 17 Nov 2003
Posts: 69
Location: New Zealand

PostPosted: Wed Apr 06, 2005 10:30 pm    Post subject: Reply with quote

Yep...sorry, I didnt realise that ssmtp wasnt a fully fledged mta out of the box.
It appears that you need to install another program "mailwrappers" to get it to authenticate to a remote server.

Sendmail is good but tricky to configure, if you cant get it working how you would like, you could have a look at Postfix.
There are plenty of howtos on the Gentoo forums that will help with Postfix setup.
Back to top
View user's profile Send private message
marky9074
Apprentice
Apprentice


Joined: 24 Sep 2004
Posts: 196
Location: UK

PostPosted: Thu Apr 07, 2005 7:13 am    Post subject: Reply with quote

Thanks for that. I am surprised there are so many relay only options out there, when you need a bit more for even the simplist actions. I mean to send a mail form from apache, there are two to three stages looking at the logs, it doesnt just go straight out!

I have had a bit more luck now with the following combo:

My sendmail.mc file contains:

define(`SMART_HOST', `auth.smtp.oneandone.co.uk') define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash /etc/mail/authinfo')dnl

My authinfo file contains:

AuthInfo:auth.smtp.oneandone.co.uk "I:<username in here>" "P:<password in here>"

My mail log file contains:

Apr 6 08:27:15 [sendmail] j368REiT005690: to=info_nospam_please_@markpayne.net, ctladdr=apache (81/81), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30168, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (j368REXX005691 Message accepted for delivery)
Apr 6 08:27:16 [sm-mta] STARTTLS=client, relay=auth.smtp.oneandone.co.uk., version=TLSv1/SSLv3, verify=FAIL, cipher=EDH-RSA-D ES-CBC3-SHA, bits=168/168

It appears to crap out at my ISPs end. I have got a reply from them but it is a computer generated generic mail.

Mark
Back to top
View user's profile Send private message
riposte
n00b
n00b


Joined: 17 Nov 2003
Posts: 69
Location: New Zealand

PostPosted: Thu Apr 07, 2005 10:35 am    Post subject: Reply with quote

I suspect that relaying it through your ISP is the most difficult option to sort out.
With sendmail, postfix,courier or one of the others covered in the gentoo docs it should be fairly easy to get it going directly from your server.
I used courier - but I wanted a fully fledged mail server so it may be excessive for your needs.
Back to top
View user's profile Send private message
marky9074
Apprentice
Apprentice


Joined: 24 Sep 2004
Posts: 196
Location: UK

PostPosted: Thu Apr 07, 2005 7:43 pm    Post subject: Reply with quote

Yes, your right it does seem stupid relaying through my isp if I can set up my own SMTP server. Has anyone seen an idiots guide to postfix (or sendmail) for that matter. You would think I would be tripping over these, but I have yet to find one.....
Back to top
View user's profile Send private message
marky9074
Apprentice
Apprentice


Joined: 24 Sep 2004
Posts: 196
Location: UK

PostPosted: Thu Apr 07, 2005 8:02 pm    Post subject: Reply with quote

I cant believe it!!!!!

I unmerged sendmail, emerged postfix, did not even open a single config file, did a test and hey presto, worked first time.

If that is not a really good example of how postfix is easy to configure I dont know what is!

Thanks for your help,

Mark
Back to top
View user's profile Send private message
riposte
n00b
n00b


Joined: 17 Nov 2003
Posts: 69
Location: New Zealand

PostPosted: Thu Apr 07, 2005 9:49 pm    Post subject: Reply with quote

Excellent!! - you might want to have a quick check of postfix's main.cf to make sure you havnt just started an open relay, should be ok by default though I think.

There are a couple of very useful howtos on the gentoo site, the virtual mailhosting one and linked from the bottom of it, the filtering mail gateway one.
Also this: https://forums.gentoo.org/viewtopic-t-56633-highlight-mailserver.html was really useful to me.

Just in case you want to set up virus filtering or get incoming email working as well!!
Back to top
View user's profile Send private message
marky9074
Apprentice
Apprentice


Joined: 24 Sep 2004
Posts: 196
Location: UK

PostPosted: Wed Apr 13, 2005 10:23 am    Post subject: Reply with quote

I've gone around and around in circles trying to find a decent how to! Now I have it working I thought I may as well get it fully working. I have looked at the howtos and did find a couple that hit the spot, but now I cant find them again! I just want a 'simple' set up. Virtual domains, but set up without using MySQL. I just want postfix, cyrus imap (or courier). Not really bothered with procmain or anti virus or spam at the moment. I just want an extremely simple set up to see it working, then add to it later once I've got my head around it.

Anyone seen any decent howtos without MySQL?
Back to top
View user's profile Send private message
riposte
n00b
n00b


Joined: 17 Nov 2003
Posts: 69
Location: New Zealand

PostPosted: Wed Apr 13, 2005 10:55 am    Post subject: Reply with quote

The courier-mta site faq describes a way to do it but its not too big on detail.

Whats wrong with a very simple, single table mysql set-up?

Here is a brilliant how-to with the simplest possible mysql back-end to handle the virtual users and using courier-mta's set-up to handle the domains:

https://forums.gentoo.org/viewtopic-t-144837-highlight-production+mail.html

HTH
Back to top
View user's profile Send private message
marky9074
Apprentice
Apprentice


Joined: 24 Sep 2004
Posts: 196
Location: UK

PostPosted: Wed Apr 13, 2005 4:56 pm    Post subject: Reply with quote

OK I've gone off on a tangent and installed postfix admin. I thought this would be a good way of managing the MySQL database if that was the way I was going to go forward....
Back to top
View user's profile Send private message
marky9074
Apprentice
Apprentice


Joined: 24 Sep 2004
Posts: 196
Location: UK

PostPosted: Wed Apr 13, 2005 5:32 pm    Post subject: Reply with quote

I get the impression from http://high5.net/howto/ that if I use courier-imap I also need to install a SASL, whereas Cyrus-imap has sasl built in. This howto looks sort of ok, though I am not sure what IMAP to use courier or cyrus.
Back to top
View user's profile Send private message
marky9074
Apprentice
Apprentice


Joined: 24 Sep 2004
Posts: 196
Location: UK

PostPosted: Thu Apr 14, 2005 8:58 am    Post subject: Reply with quote

OK, I intend to write this up as a real idiots guide eventually. I just went to my ISP (1and1) and edited the DNS details. Now I entered in MX:

mail.mydomain.co.uk

and in Pri:

10

Now, I am not sure if this was correct, but it let me accept it anyway! And I guess I now have to open up ports on my firewall to let it through? I have created the domain and mailbox using postfix admin so that is there. The only thing that is missing from there howto is the maildir setup! I see that in the config it labels a location for where the mail is, but there is no reference to the format or creating the mail dirs!

I am determined to get through this without getting a major bloated setup!


Last edited by marky9074 on Thu Apr 14, 2005 2:46 pm; edited 2 times in total
Back to top
View user's profile Send private message
marky9074
Apprentice
Apprentice


Joined: 24 Sep 2004
Posts: 196
Location: UK

PostPosted: Thu Apr 14, 2005 2:45 pm    Post subject: Reply with quote

OK, I started working through the virtual mail how to in the gentoo docs, after deciding it didnt look that bad..

I got stuck at 6.1 telnet in and check AUTH & STARTTTLS

Mine shows:

250-mail.mydomain.co.uk
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250 8BITMIME

The auth bits arent there. I also think the tutorial skips over a lot regarding when you actually create the certs, there are questions that are asked that I wasnt sure what the hell I was supposed to put in...

Also there was no smtpd.conf file in /etc/sasl2 I had to create it.
Back to top
View user's profile Send private message
marky9074
Apprentice
Apprentice


Joined: 24 Sep 2004
Posts: 196
Location: UK

PostPosted: Thu Apr 14, 2005 3:43 pm    Post subject: Reply with quote

Changed my mind again and am now emerging courier.....
Back to top
View user's profile Send private message
marky9074
Apprentice
Apprentice


Joined: 24 Sep 2004
Posts: 196
Location: UK

PostPosted: Thu Apr 14, 2005 5:05 pm    Post subject: Reply with quote

Hi riposte,

I am progressing through the production mail server howto...but...

Configuring courier

edit /etc/courier/authmysqlrc (This file doesnt exist!)
edit /etc/courier/authdaemonrc (This files doesnt exist!)
edit /etc/courier/aliases/system
edit /etc/courier/hosteddomains (This files doesnt exist!)
edit /etc/courier/smtpaccess/default

Now I can create this files and wing it. But say the authdaemnonrc refers to a part of the file, so assuming that it is actually there in the first place.

Have you got these files?

Mark
Back to top
View user's profile Send private message
marky9074
Apprentice
Apprentice


Joined: 24 Sep 2004
Posts: 196
Location: UK

PostPosted: Fri Apr 15, 2005 10:03 am    Post subject: Reply with quote

I understand that these now live in /etc/courier/authlib.....but that is not there either!
Back to top
View user's profile Send private message
marky9074
Apprentice
Apprentice


Joined: 24 Sep 2004
Posts: 196
Location: UK

PostPosted: Fri Apr 15, 2005 11:42 am    Post subject: Reply with quote

I had to emerge net-libs/courier-authlib again (even though this was already installed) and it appeared!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on Sparc All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum