Magento and Sendmail

Hi everyone,

Is there an easy way to setup sendmail for magento or should I follow the instructions below and go with postfix:

http://www.purplehat.org/?page_id=4

It seems a little overkill to install Maia-mailguard, SpamAssassin, ClamAV since I just need the mail server to send the magento invoices and account creation emails. I don't want people replying to the emails nor will people be using the mail server to send them.

Again, Only magento will be communicating with sendmail.

Here's my current setup:
Internet
|
DSL
|
pfsense (DynamicDNS for domain with DynDNS.com)
|
FreeBSD with Apache22, MySQL, PHPAdmin, Magento

Pfsense [System-GeneralSetup]
Hostname: ar
Domain: mydomain.com

NAT
WAN TCP 80 (HTTP) 192.168.1.250 (ext.: 216.xxx.xxx.xxx) 80 (HTTP) WWW

DynDns DNS Records:
ar.mydomain.com A-record 216.xxx.xxx.xxx
http://www.mydomain.com Alias (CNAME) ar.mydomain.com

I can access the site no problems but I'm having a hardtime grasping the smtp portion of Magento. I've read the new book "Magento Beginners Userguide" but there's nothing in there for smtp setup. Although it does mention that it's compatible with sendmail without further explanation.

Could someone point me in the right direction? A forum posting for sendmail and magento or anything similar. I'm going to chapters tomorrow to buy myself the o'reilly book on sendmail however I'm scared by the fact that most people are saying it's very hard to master.

On another note, is it bad to be using dynamic dns with mail servers. Should I be looking into building and using my own DNS servers?

Thanks,

Fatman
a.k.a Mr. Hu Mongous
 
I'm guessing that Magento (which I've never heard of or worked with) simply drops outgoing email (which is what we're talking about, I presume) on localhost for further delivery. In a default FreeBSD installation, Sendmail starts and listens on localhost for email to be sent.

This should show up on a default installation:

Code:
$ ps ax | grep sendmail
  887  ??  Ss     0:00.02 sendmail: accepting connections (sendmail)
  891  ??  Is     0:00.00 sendmail: Queue runner@00:30:00 for /var/spool/client
Code:
$ sockstat -4 -p 25
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS      
root     sendmail   887   3  tcp4   127.0.0.1:25          *:*

Sendmail will not listen on any other interface unless you're telling it to, so you don't have an open mailserver exposed to other networks.
 
Thanks DutchDaemon for the reply.

I just bought the Oreilly Sendmail book in case I need it.

So I guess sendmail is running and for some reason it's established a connection with google:

Code:
box# sockstat -4 -p 25
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
root     sendmail   761   6  tcp4   192.168.1.250:64517   209.85.221.45:25
root     sendmail   759   4  tcp4   127.0.0.1:25          *:*

Code:
Your WHOIS Search Results
209.85.221.45 
Record Type: IP Address 
 
OrgName:    Google Inc. 
OrgID:      GOGL
Address:    1600 Amphitheatre Parkway
City:       Mountain View
StateProv:  CA
PostalCode: 94043
Country:    US

NetRange:   209.85.128.0 - 209.85.255.255 
CIDR:       209.85.128.0/17 
NetName:    GOOGLE
NetHandle:  NET-209-85-128-0-1
Parent:     NET-209-0-0-0-0
NetType:    Direct Allocation
NameServer: NS1.GOOGLE.COM
NameServer: NS2.GOOGLE.COM
NameServer: NS3.GOOGLE.COM
NameServer: NS4.GOOGLE.COM
Comment:    
RegDate:    2006-01-13
Updated:    2006-06-01

OrgTechHandle: ZG39-ARIN
OrgTechName:   Google Inc. 
OrgTechPhone:  +1-650-318-0200
OrgTechEmail:  [email]arin-contact@google.com[/email]

box# ps ax | grep sendmail
  759  ??  Ss     0:00.01 sendmail: accepting connections (sendmail)
  761  ??  I      0:00.01 sendmail: ./n4333POW001260 mx3.hotmail.com.: user ope
  768  ??  Is     0:00.00 sendmail: Queue runner@00:30:00 for /var/spool/client
  840  ??  Is     0:00.00 sendmail: ./n47DTZZe000776 mx3.hotmail.com.: user ope
  869  p0  R+     0:00.00 grep sendmail

Dutch, what should be my next step in troubleshooting the issue?

I little research on sendmail gave me the following:

***
When it receives an incoming message, it puts that message in the main mail queue, and, if the load average is less than QueueLA (which in typical configurations is smaller than RefuseLA), it immediately spawns a sendmail process to attempt to send that message and only that message. If that attempt to send fails, the message stays in the queue.
***

Looks like the messages are not being send and stuck in queue:

Code:
768  ??  Is     0:00.00 sendmail: Queue runner@00:30:00 for /var/spool/client

I can view the mx records for a domain:
Code:
box# host -t mx hotmail.com
hotmail.com mail is handled by 5 mx2.hotmail.com.
hotmail.com mail is handled by 5 mx3.hotmail.com.
hotmail.com mail is handled by 5 mx4.hotmail.com.
hotmail.com mail is handled by 5 mx1.hotmail.com.

Do I need to setup some sort of mail relaying through my ISP? I also have a googleapps account, could I forward it through there?

How can I test sending a single email right now?

I also found this tutorial that talks about using the ssmtp port. Would you recommend I use this instead?

Section: 28-8
http://admin.jugamanusia.com/freebsd-handbook-chapter-28-electronic-mail/

Thanks,

Fatman
 
Please use code tags for posting system output (see last line in my signature on how to).

As far as I can see, your local Sendmail is running fine, and mail is being sent out. The qrunner line means just that: a queue runner takes care of locally queued mail and tries to deliver it. It's always 'on'.

Take a look at /var/log/maillog to spot whether mail is delivered (Stat=Sent) or rejected (error 4xx/5xx). For example, when you're on a dynamic IP address or a residential DSL/cable connection, you should use your ISP's mailserver (either directly or instructing Sendmail using the SmartHost directive).

It's all in the book!
 
Thanks for the advice.

I'm still a little confused and can't seem to locate the information I require from the book.

On page 597, they reference SMART_HOST and provide a description however they do not go into further details.
[17.3.3.6 SMART_HOST mc macro]

Also,

The instructions at the begining of the book seem to be for a fresh install. I recently update the system, do you recomend I re-install from source or from the /usr/ports/mail/sendmail? If anything, I prefer the latter since I can track it through portaudit.

This did lead me to do some google searching where I found what I believe to be some good info even though it geared towards debian.

http://www.joshfrank.com/articles/sendmail_smart_host

Snipit #1 - From Site
Configuring Sendmail
This is not very difficult. you sendmail configuration files should be located in /etc/mail. Open a file called sendmail.mc and we will add the following line.

define(`SMART_HOST', `mail.isp.net')

I don't have sendmail.mc..

Code:
www# ls /etc/mail
Makefile                freebsd.cf              mailer.conf
README                  freebsd.mc              mailertable.sample
access.sample           freebsd.submit.cf       sendmail.cf
aliases                 freebsd.submit.mc       submit.cf
aliases.db              helpfile                virtusertable.sample

Do I need to create the file? Is it as simple as adding it to sendmail.cf.

SnipiT #2
Using Passwords

create a file called /etc/mail/authinfo
Containing:
AuthInfo:myisp.com "U:UserName" "I:UserName" "P:YoUrPaSSw0rd"

I've gathered the necessary info from my ISP. Can I follow the above and install /usr/ports/security/cyrus-sasl2 then create the file?

Thanks,

Fatman
 
I would follow the purplehat tutorial as you will have a fully featured and functioning MTA should whatever you are selling with Magento rise to the level of requiring such. I did that tutorial over a year ago and am still satisfied with the results!
 
If you run 'make' in /etc/mail, you will end up with a .mc file with your hostname as its name. Put the smarthost directive in there as advertised, and run make again. Rename the resulting .cf file to sendmail.cf and restart Sendmail. Are you sure your ISP needs username/password for relaying email? Most ISPs accept email from their own IP ranges and relay it without further ado.
 
Back
Top