Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,194,178 members, 7,953,643 topics. Date: Thursday, 19 September 2024 at 09:39 PM

Php Mail Function - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Php Mail Function (839 Views)

Function Points (FP) Vs Lines Of Code (LOC) / [problem] Write A Program In C++ That Finds The Hcf Of 2 Numbers Without Using A Recursive Function / Without Using Pow Function In C (2) (3) (4)

(1) (Reply) (Go Down)

Php Mail Function by okabose: 2:55pm On Jan 21, 2010
--------------------------------------------------------------------------------
I have been using the 'below' script to send mail from almost all my websites. And it's working fine.

But this script does not work in all the websites in RAPHSOFTHOST.COM reseller package. It can only send to the host website. It cannot send to the sender like a yahoo email address or another email address that is not from the host website.

Can anybody help?

The script

<?php
session_start();
$msg = "Below is an email from your website\n\n";
$msg .= "NAME: $_POST[name]\n\n";
$msg .= "EMAIL: $_POST[email]\n";
$msg .= "PHONE: $_POST[phone]\n";
$msg .= "NATIONALITY: $_POST[nationality]\n";
$msg .= "MESSAGE: $_POST[msg_body]\n";
$email = $_POST[email];
//set up the mail
$subject = "mail from our Website";
$recipient = "info@wholisticoutreachonline.org";
$mailheaders = "From: $name $email";
//send the mail
mail($recipient, $subject, $msg, $mailheaders, $email);
// send mail to the sender

$msg2 = "Hello $_POST[name], your mail has been received.\n ";
$msg2 .= "We are really glad that you mailed us and we will give you a reply soonest.\n\n";
$msg2 .= "You can visit our website any time.\n\n";

$msg2 .= "Thanks\n";


$email2 = $_POST["email"];
//set up the mail
$sender2 = "info@wholisticoutreachonline.org";
$subject2 = "Confirmation Mail From Wholistic Outreach.";
$recipient2 = "$email2";
$mailheaders2 = "From: $sender2";
//send the mail
mail($recipient2, $subject2, $msg2, $mailheaders2, $sender2);

$_SESSION["name"] = $_POST["name"];
$_SESSION["msg"] = "Hello ". $_SESSION["name"] . ", Your mail has been received and a confirmation mail sent to you.<br><br>
Thank you for contactiing us.";
function navigate($page) {echo "<script language='javascript'>location='$page';</script>";exit;}
navigate("send_mail_page.php"wink;
?>
Re: Php Mail Function by yawatide(f): 4:03pm On Jan 21, 2010
If it has been working everywhere else except this host, chances are that, and I speak based on experience with a couple hosts of late, the host has "turned off" the use of the mail() function due to its abuse by spammers.

The only way to get around this (I have been too lazy to do this myself and have thus resorted to pasting the actual email address on the "contact" pages of sites concerned grin) is to use SMTP to send mails on such hosts.

I hope this helps.
Re: Php Mail Function by okabose: 4:46pm On Jan 21, 2010
The SMTP did not work. Think the PERL Package is not Installed. What do I do?
Re: Php Mail Function by yawatide(f): 4:59pm On Jan 21, 2010
Then you, my friend, are screwed tongue

Seriously though, if this is just for a "contact us" page, if you really need it, contact the host and ask if they support SMTP. If they do, ask why your code isn't working. Perhaps they need to "turn on" something on their end. If you don't really need it, since you say that emails with the domain's extension go through, just send the mail as usual and on the "thank you" page, indicate (though not necessarily true wink) that though your system for sending confirmation emails is down, they can rest assured that their email has been delivered and that someone will be contacting them soon. Where all else fails, just take out the form altogether and put up a page with the physical and email addresses of the company.

If the above doesn't work out, sorry I couldn't be of any more help.
Re: Php Mail Function by okabose: 11:09am On Jan 22, 2010
They just installed the Pear package. And the SMTP worked. I will still try it again.

Thank you my brother.

God bless you
Re: Php Mail Function by yawatide(f): 11:49am On Jan 22, 2010
I am glad I could be of help. It's always a pleasure to see that a problem has been solved and there is something to learn from the process.
Re: Php Mail Function by kwenu: 4:37pm On Jan 24, 2010
HEY GUYS GOOD TO HAVE YOU ONLINE ,PLEASE I AM NEW TO PROGRAMMING AND I WANNA KNOW HOW TO BUILD A PHP MASS MAILER ,PLEASE I NEED YOUR HELP, NEED YOU GUYS TO SHOW ME HOW TO IN PRACTICE HERE IS MY EMAIL
EARLY.MANN@YAHOO.COM
HERE IS MY PHONE NUMBER 07026846574 PLEASE EMIAL ME AND CALL ME I LL APPRECIATE ALL EFFORTS FROM YOU ALL

(1) (Reply)

Why Seperate Database On Applications / Page Not Redirecting / How Well Do You Understand And Write Your Local Language?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 15
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.