[sf-lug] Sendmail configuration
Doug Bierer
doug at unlikelysource.com
Fri Mar 21 22:46:24 PDT 2008
Not sure how you're using PHP ... but here's a code snippet which works:
---------------------------------------------------------
// Send email to verify
$message = "Whatever you want to say.";
$to = "doug at unlikelysource.com";
$subject = "Test Message";
$headers = "From: noreply at unlikelysource.com\r\n" .
"X-Mailer: PHP/" . phpversion();
$body = $message;
$body = wordwrap($body, 40);
if (mail($to, $subject, $body, $headers)) {
echo "<P>Message Sent Successfully</P>\n";
} else {
echo "<P>Message Not Sent</P>\n";
}
--------------------------------------------------------
Notice the use of the $headers variable. This is where you can program
in the "From" field to put in anything you want. The wordwrap()
function is optional.
db
On Thu, 2008-03-20 at 03:37 +0530, Deepan wrote:
> Hi All,
> I am using sendmail via php mail function to send
> emails. However few servers reject my mails with
> the error 'Sender address rejected: Domain not
> found', since mails from my server are sent as
> email at localhost.localdomain. How do I change this
> to a valid domain name ? We only own a public IP.
> we dont really have a domain name, is it possible
> to use IP ?
> Regards
> Deepan
> Facebook Sudoku Solver:
> http://apps.facebook.com/sudokusolver/
> Sudoku Solver: http://www.sudoku-solver.net/
> Home Page: http://www.codeshepherd/
>
>
>
> _______________________________________________
> sf-lug mailing list
> sf-lug at linuxmafia.com
> http://linuxmafia.com/mailman/listinfo/sf-lug
More information about the sf-lug
mailing list