in reply to How do I send an email using the user's sendmail program than my sendmail?

Short answer: No.

Longer answer: The web is a stateless protocol, in other words your script only runs and generates (usually text) output and then quits, the output gets sent to the client by your webserver, which assuming they are running a standard webbrowser to connect to your script then all they can see is the output, wheither that output is a command or not.

There are some alternatives but it really depends on your clients having their own CGI script in which to grab your output and then email it that way. You can do that, but I think that probably defeats the purpose of what you're trying to do.

Finally the easy solution to what I think you're trying to do (correct me if I'm wrong) :), if you just want to show the email as being from a certain website or user, you can make the From: field of your outgoing email whatever you want it to be, regardless of where you actually send it from. Have a look at MIME::Lite which is my prefered method for sending email (easy to do attachments as well if you need something like that)

Hope that helps
Chris

Update fixed a typo.

Lobster Aliens Are attacking the world!
  • Comment on Re: How do I send an email using the user's sendmail program than my sendmail?

Replies are listed 'Best First'.
Re: Re: How do I send an email using the user's sendmail program than my sendmail?
by tilly (Archbishop) on Jul 14, 2003 at 16:28 UTC
    I would advise against using this trick.

    Forging an arbitrary From: field is a classic spamming technique, so a lot of spam filters look for signs of that and flag or block those emails as spam.

      No no, not an arbitrary From: field. I'm assuming that he's trying to do a single email form for multiple sites or domains. He could check the REFERER to make sure its an allowed domain and then send an email with the from field being an address at that domain. So if foo.com is allowed to send mail through his form and a request comes from foo.com he sends the email with the From field with someone@foo.com where someone@foo.com is a real person expecting a reply perhaps.

      That would work for most cases and where a client isn't sending the REFERER or its wrong then the connection is dropped, eleminates spammers. Maybe I should have been more clear.

      On another note, companies that are hosting multiple websites do this sort of thing all the time (I know mine does) do you consider it to be SPAM? Even if the email goes to a real person and the person receiving the email knows they are getting it?

      Lobster Aliens Are attacking the world!
        If he is concerned with offloading the emails because he wants to avoid strain on his email system, then I would strongly suspect that the people who he is trying to send emails for are from companies that his email server doesn't normally forward emails for.

        Therefore he would be forging emails for domains that are unassociated with his server, and would be flagged as spam.

        If the emails are forged for his own domain, then externally this issue goes away. I know why this is useful, and I have forged emails myself. However he still may have an unusual characteristic which causes his email to be flagged by some as a sign of spam. (Been there, done that as well...)