LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-24-2009, 12:19 AM   #1
neilius
LQ Newbie
 
Registered: Jun 2009
Location: San Jose, CA
Posts: 4

Rep: Reputation: 0
Send email to specific SMTP servers per email from my server?


First post here:

I have a linux based system as a web server with php/mySQL and provide a service to my clients that allows them to send individual emails to their own clients as part of managing their vacation rental business. Currently I send the email from my server using sendmail and change the reply-to field to my client's email address.

What I want to do to instead is send the email via my client's own email account to avoid my server potentially being blacklisted and to reduce the chance of the email being considered spam. I would collect their own mail server details and just need a way to get the emails that I currently send via sendmail re-directed to their own server for sending.

I am not a mail expert and so perhaps what I'm asking is really easy to do and I'm being blinded by my current use of sendmail? Can anyone suggest the right way to do this?

Many Thanks
Neilius

PS: I don't have linux "users" defined for my clients - just in my web application.
 
Old 06-24-2009, 03:38 AM   #2
fotoguy
Senior Member
 
Registered: Mar 2003
Location: Brisbane Queensland Australia
Distribution: Custom Debian Live ISO's
Posts: 1,291

Rep: Reputation: 62
Sounds like you are needing a mail relay, you can setup sendmail as a mail relay for your clients domains, it will send and receive mail to and from their servers. Your server will effectively receive then forward the mail without having to change any email addresses, domain names etc.

For security reasons, sendmail does not relay mail by default, this is typically used by spammers, you will need to add all the domains you want to relay into a file, you will need to do a google search on setting up a relay for sendmail.

Hope this points you in the right direction
 
Old 06-24-2009, 09:28 AM   #3
neilius
LQ Newbie
 
Registered: Jun 2009
Location: San Jose, CA
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by fotoguy View Post
Sounds like you are needing a mail relay, you can setup sendmail as a mail relay for your clients domains, it will send and receive mail to and from their servers. Your server will effectively receive then forward the mail without having to change any email addresses, domain names etc.

For security reasons, sendmail does not relay mail by default, this is typically used by spammers, you will need to add all the domains you want to relay into a file, you will need to do a google search on setting up a relay for sendmail.

Hope this points you in the right direction
Thanks fotoguy.

I'd looked into this and concluded that if my clients were using, say, gmail as their mailing address then I would have to add the gmail.com domain to the list - and surely that will open up my server for considerable abuse - unless there's some way to restrict it.

Also, my client's will be initiating email from my server and not their normal email account login - I effectively need to get the email in my system to their (eg. gmail) email servers somehow.

In my mind, when one sets up an email client one enters the server info for incoming and outgoing email. Ideally I need a commandline way of sending an email via a particular smtp server each time that I invoke it. Maybe there's a way of specifying the smtp server as commandline args (to sendmail or some other mailer) or some file config that I can specify that makes the mailer choose the correct smtp server based upon the "from" email address? I have seen the 'SMART_HOST' feature in sendmail but that appears to be a single SMTP server for all emails.

Does that make more sense now?

Thanks,
Neil
 
Old 06-24-2009, 09:58 AM   #4
luisduenas
LQ Newbie
 
Registered: Dec 2008
Distribution: Debian - pero ya no.
Posts: 22

Rep: Reputation: 0
Quote:
Originally Posted by neilius View Post
Currently I send the email from my server using sendmail and change the reply-to field to my client's email address.
is only one customer( one domain ) or several domains ??
and how you change that ? ( I suppose using PHP-from not command line)

Quote:
Originally Posted by neilius View Post
What I want to do to instead is send the email via my client's own email account
I think you did it allready, or you mean their own email server ?

Quote:
Originally Posted by neilius View Post
avoid my server potentially being blacklisted and to reduce the chance of the email being considered spam.
Your server ip address is going to be the ip address originator always, no matter what you change.

but the smart host could help to reduce the risk if the smart host , has the antispam , rate limit , antivirus control.

But as you say you dont want it.


use PHP whit SMTP Authentication to send e-mails.
Your customers have to use their e-mail servers, user, password.
For last be sure to disable the MTA to external email.

script example.
http://email.about.com/od/emailprogr...t/et073006.htm
 
Old 06-24-2009, 10:35 AM   #5
neilius
LQ Newbie
 
Registered: Jun 2009
Location: San Jose, CA
Posts: 4

Original Poster
Rep: Reputation: 0
I think I've found something that will do what I need at: http://www.phpguru.org/downloads/Rma...l%20for%20PHP/

Not tried/tested it yet but purports to have a send option via SMTP as well as mail() or sendmail(). Looks like I can bypass sendmail and do a direct SMTP send.

Thanks for your help.
Neilius
 
Old 06-24-2009, 10:44 AM   #6
neilius
LQ Newbie
 
Registered: Jun 2009
Location: San Jose, CA
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by luisduenas View Post
is only one customer( one domain ) or several domains ??
and how you change that ? ( I suppose using PHP-from not command line)

I think you did it allready, or you mean their own email server ?


Your server ip address is going to be the ip address originator always, no matter what you change.

but the smart host could help to reduce the risk if the smart host , has the antispam , rate limit , antivirus control.

But as you say you dont want it.


use PHP whit SMTP Authentication to send e-mails.
Your customers have to use their e-mail servers, user, password.
For last be sure to disable the MTA to external email.

script example.
http://email.about.com/od/emailprogr...t/et073006.htm
Ah, thanks! It looks like the PEAR package referenced here is an alternative to the Rmail solution that I just located. I'll check that out further.

I have at least 2 solution now

Cheers,
Neilius
 
Old 06-25-2009, 06:31 AM   #7
fotoguy
Senior Member
 
Registered: Mar 2003
Location: Brisbane Queensland Australia
Distribution: Custom Debian Live ISO's
Posts: 1,291

Rep: Reputation: 62
Ok getting a better understanding now on what you want. Yes opening up to a domain like gmail.com would allow all users of that domain access to your server, to safe guard this you would use white and blacklists. You could blacklist the whole gmail.com domain, then only allow specific email address through the relay.

If you need to use the command line, I use a little perl script, which is an email client, for all my admin tasks on my web/mail server called 'sendEmail'. This allows you to send email with any email address you specify as the sender or receiver, also can send to any smtp server. I use this in conjunction with bash scripts, this may be worth checking out.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache virtual host send email without email server SibLiant Linux - Software 6 06-03-2009 09:46 PM
setup an smtp server to send email everywhere mariogarcia Linux - Server 3 08-04-2007 09:10 PM
Need to set up personal SMTP server to send email Whiskers Linux - General 3 08-29-2004 02:33 PM
Using Postfix the send email via another smtp server - to anyone. scarstens Linux - Newbie 1 01-27-2004 03:31 PM
SENDMAIL as an SMTP RELAY SERVER that can send email to internet. how? kublador Linux - Software 7 10-25-2003 08:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration