Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
[ccgi] using PHP mail() with domains
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- [ccgi] using PHP mail() with domains
[ccgi] using PHP mail() with domains
09-02-2009 9:02 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Hi,
I have two domains hosted on the ccgi server and I would like to generate emails fromphp that have the appropriate From address.
I have tried several variations on the headers field in the mail function but the email always somes from some "Force9 user<jepson@ptn-ccgi01.plus.net>".
Is there any way to get it to use a valid from address?
I have two domains hosted on the ccgi server and I would like to generate emails fromphp that have the appropriate From address.
I have tried several variations on the headers field in the mail function but the email always somes from some "Force9 user<jepson@ptn-ccgi01.plus.net>".
Is there any way to get it to use a valid from address?
Message 1 of 4
(1,091 Views)
3 REPLIES 3
Re: [ccgi] using PHP mail() with domains
09-02-2009 9:20 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Try this little script to test:
[tt]smtp.force9.net[/tt] is just an example (and probably doesn't work) so use the force9 smtp server that you use at home.
The fourth paramater to mail() [tt]"From: you@yourdomain"[/tt] should be the key to your success. Hopefully.
<?php
ini_set("SMTP","smtp.force9.net");
ini_set("smtp_port","25");
define("RCPT_EMAIL", "addressee@foo.com");
define("SNDR_EMAIL", "you@yourdomain.com");
define("EMAIL_SUBJECT", "TESTING");
$message = "It worked!";
mail(RCPT_EMAIL, EMAIL_SUBJECT, $message, "From: ".SNDR_EMAIL);
?>
Mail sent :)
[tt]smtp.force9.net[/tt] is just an example (and probably doesn't work) so use the force9 smtp server that you use at home.
The fourth paramater to mail() [tt]"From: you@yourdomain"[/tt] should be the key to your success. Hopefully.
Message 2 of 4
(360 Views)
Re: [ccgi] using PHP mail() with domains
10-02-2009 10:52 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I always do this using the optional additional_parameters argument (see http://uk.php.net/manual/en/function.mail.php)
e.g.:
e.g.:
<?php
$to = 'someone@example.com';
$from = 'someoneelse@example.com';
$subject = 'Test mail';
$headers = "From: $from";
$message = 'Test, please ignore';
mail ($to, $subject, $message, $headers, "-f $from");
?>
Message 3 of 4
(360 Views)
Re: [ccgi] using PHP mail() with domains
10-02-2009 7:23 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Thanks to you both.
I tried that, or at least I tried to try that yesterday but it wouldn't work. Your script worked first time. Great.
I tried that, or at least I tried to try that yesterday but it wouldn't work. Your script worked first time. Great.
Message 4 of 4
(360 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- [ccgi] using PHP mail() with domains