Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Send Email using PHP
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Send Email using PHP

 Post Reply Post Reply
Author
ajwposh View Drop Down
Newbie
Newbie


Joined: 20 May 2010
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote ajwposh Quote  Post ReplyReply Direct Link To This Post Topic: Send Email using PHP
    Posted: 16 November 2010 at 4:45pm
I am looking to send an email on my PHP website but I am not sure how to do it.

When using Classic ASP I used objCDOSYSMail.

Is there anything similar I can use for PHP?

Thanks
Back to Top
123Simples View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 July 2007
Location: United Kingdom
Status: Offline
Points: 1192
Post Options Post Options   Thanks (0) Thanks(0)   Quote 123Simples Quote  Post ReplyReply Direct Link To This Post Posted: 16 November 2010 at 6:37pm
Are you on web wiz hosting, or with another provider. Sending PHP mail on webwiz - link
Sending on another providers would depend on how the form is setup..
An example can be found at this site which may help you - link
Back to Top
ajwposh View Drop Down
Newbie
Newbie


Joined: 20 May 2010
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote ajwposh Quote  Post ReplyReply Direct Link To This Post Posted: 16 November 2010 at 6:52pm
Thank you. I am with web wiz and have used what you have suggested which works, however, I am only able to send a text only email. How would I go about sending a HTML email which includes php variables?

Thanks
Back to Top
123Simples View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 July 2007
Location: United Kingdom
Status: Offline
Points: 1192
Post Options Post Options   Thanks (0) Thanks(0)   Quote 123Simples Quote  Post ReplyReply Direct Link To This Post Posted: 16 November 2010 at 8:02pm
I'd have to check - someone may post here who knows about PHP Mail on webwiz as I don't myself really use php mail - it's too confusing LOL
Bruce will be able to give you the answer tomorrow for sure though, but Scotty and others will maybe jump in too. Welcome to the forum by the way
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 17 November 2010 at 2:41pm
PHP built in email sending is useless as it sends all emails from the same address for everyone on the server and does not support authentication for relaying emails to remote mailboxes.

We do have PHP PEAR installed on the servers which allows you to send email from your own email address and use authentication to relay emails to a non-local mailbox.

I found the page below which has some examples of sending email using PHP Pear:-

Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post Posted: 17 November 2010 at 9:19pm

Not sure what you mean bruce (Im no expert with php, so maybe I miss understood)

But cant you set the "from" email address using the header? like so:

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>


(Taken from the official PHP mail page)

S2H.co.uk - WebWiz Mods and Skins

For support on my mods + skins, please use my forum.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 18 November 2010 at 2:33pm
You also need to include authentication, hence the reason for needing to use Pear to send emails when using PHP on our servers.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.