Print Page | Close Window

Send Email using PHP

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: General Discussion
Forum Description: General discussion and chat on any topic.
URL: https://forums.webwiz.net/forum_posts.asp?TID=28963
Printed Date: 28 March 2026 at 2:21pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Send Email using PHP
Posted By: ajwposh
Subject: Send Email using PHP
Date 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



Replies:
Posted By: 123Simples
Date Posted: 16 November 2010 at 6:37pm
Are you on web wiz hosting, or with another provider. Sending PHP mail on webwiz - http://www.webwiz.net/kb/webhosting/sending_web_form_mail.asp" rel="nofollow - 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 - http://www.mikeheuss.com/scripts/EmailFormPost/instructions.php" rel="nofollow - link


-------------
http://www.123simples.com/" rel="nofollow - Visit 123 Simples Web Design


Posted By: ajwposh
Date 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


Posted By: 123Simples
Date 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


-------------
http://www.123simples.com/" rel="nofollow - Visit 123 Simples Web Design


Posted By: WebWiz-Bruce
Date 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:-

http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm" rel="nofollow - http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: Scotty32
Date 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 http://php.net/manual/en/function.mail.php" rel="nofollow - official PHP mail page )



-------------
S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins

For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .


Posted By: WebWiz-Bruce
Date 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.

-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net