| Author |
Topic Search Topic Options
|
ajwposh
Newbie
Joined: 20 May 2010
Status: Offline
Points: 15
|
Post Options
Thanks(0)
Quote Reply
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
|
 |
123Simples
Senior Member
Joined: 08 July 2007
Location: United Kingdom
Status: Offline
Points: 1192
|
Post Options
Thanks(0)
Quote Reply
Posted: 16 November 2010 at 6:37pm |
Are you on web wiz hosting, or with another provider. Sending PHP mail on webwiz - linkSending on another providers would depend on how the form is setup.. An example can be found at this site which may help you - link
|
|
|
 |
ajwposh
Newbie
Joined: 20 May 2010
Status: Offline
Points: 15
|
Post Options
Thanks(0)
Quote Reply
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
|
 |
123Simples
Senior Member
Joined: 08 July 2007
Location: United Kingdom
Status: Offline
Points: 1192
|
Post Options
Thanks(0)
Quote Reply
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  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
|
|
|
 |
WebWiz-Bruce
Admin Group
Web Wiz Developer
Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
|
Post Options
Thanks(0)
Quote Reply
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:-
|
|
|
 |
Scotty32
Moderator Group
Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
|
Post Options
Thanks(0)
Quote Reply
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)
|
|
|
 |
WebWiz-Bruce
Admin Group
Web Wiz Developer
Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
|
Post Options
Thanks(0)
Quote Reply
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.
|
|
|
 |