Free Web Hosting Forum
(#1 (permalink))
Old
Junior Member
denny848337 is on a distinguished road
 
Posts: 7
Join Date: Jun 2009
Default mail function doesn't workk - 06-25-2009, 07:07 PM

my script..
i try this, but i don't get this emaill...
can smeone help me??
i'm newbie here >_<
PHP Code:
$to $baruemail;
                
$subject "Selamat Datang di photoku.com";
                
$from "admin@photoku.hostei.com";
                
$headers "MIME-Version: 1.0" "\r\n";
                
$headers .= "Content-type:text/html;charset=iso-8859-1" "\r\n";
                
$headers .= "From: $from";
                
$message "
                <html>
                <head>
                <title>Photoku.com</title>
                </head>
                <body>
                Selamat datang, <br /> USERNAME belum diaktifkan.
                <table>
                 <tr>
                  <td>USERNAME</td><td>$baruuname</td>
                 </tr>
                 <tr>
                  <td>NAMA</td><td>$baruname</td>
                 </tr>
                 <tr>
                  <td>TAHUN LAHIR</td><td>$barutahun</td>
                 </tr>
                 <tr>
                  <td>JENIS KELAMIN</td><td>$barusex</td>
                 </tr>
                 <tr>
                  <td>KODE VERIFIKASI</td><td>$randomstring</td>
                 </tr>
                </table>
                </body>
                </html>
                "
;
                
$message str_replace("."".."$message);
                
mail($to,$subject,$message,$headers); 
Reply With Quote
(#2 (permalink))
Old
chanh's Avatar
Administrator
chanh is on a distinguished road
 
Posts: 1,850
Join Date: Dec 2008
Default 06-25-2009, 10:27 PM

I only know server24 mail does not work correct. Which server are you on?
Reply With Quote
(#3 (permalink))
Old
Junior Member
denny848337 is on a distinguished road
 
Posts: 7
Join Date: Jun 2009
Default 06-26-2009, 03:36 AM

i'm in server33.000webhost.com
is it doesn't work??
thx
Reply With Quote
(#4 (permalink))
Old
greenfloyd's Avatar
Member
greenfloyd is on a distinguished road
 
Posts: 75
Join Date: Jan 2009
Location: Portland, Oregon
Default 06-26-2009, 04:42 AM

I've had the same problem on server 17. The mail service goes in and out. To work around this I try to use the client's mail service if mail() is down.

Code:
$em_status = confirm_email($user_email, "Sign Up Verification", $confirm_text, $confirm_link);

if(!$em_status) { 
	$confirm_link = "http://greenfloyd.site90.com/_roller.private.php?action=3&confirm_key=" . $confirmKey;
	$confirm_link = rawurlencode($confirm_link);
	$message = "Sign Up Verification: If this is your submission to the greenfloyd Roller~Poster, please click this VERIFY link: $confirm_link";
echo $confirm_link . "<br>";
echo "<p>For some reason internal Email failed.  Please try this \"Plan B\" link instead, it will send an unformatted email to you through your mail service.  Then, from your inbox, click the \"VERIFY\" link in the message  to complete the verification process.<br> Thank you.<hr><a href = 'mailto:".$user_email."?subject=Roller~Poster_Sign_Up&body=".$message."'>plan B</a><hr><a href = 'http://greenfloyd.site90.com/_roller.readerX.php'>[Return]</a><hr>";
} else {
	echo "<p>To activate your new account a confirmation email has been sent to you.  Please click the link in that email to complete the verification process.  Further instructions will be displayed on the confirmation page... enjoy the ride.<hr><a href = 'http://greenfloyd.site90.com/_roller.readerX.php'>[Return]</a><hr>";
			}
Reply With Quote
(#5 (permalink))
Old
Junior Member
denny848337 is on a distinguished road
 
Posts: 7
Join Date: Jun 2009
Default 06-26-2009, 04:57 AM

i'm so sorry,, i don't understan what do you say,, can you explain it??
thxx
Reply With Quote
(#6 (permalink))
Old
greenfloyd's Avatar
Member
greenfloyd is on a distinguished road
 
Posts: 75
Join Date: Jan 2009
Location: Portland, Oregon
Default 06-26-2009, 07:46 AM

Quote:
Originally Posted by denny848337 View Post
i'm so sorry,, i don't understan what do you say,, can you explain it??
thxx
I hope so...

Basically I'm creating a simple "mailto" link that will call the client's mail service, like Outlook Express for example. This alloww the user to send the email through their own system. Of course this depends on the user having a "mail client" active in their browser. You can do the same thing with simple HTML. The important part is this:

Code:
<a href = 'mailto:".$user_email."?subject=Roller~Poster_Verification&body=".$message."'>
plan B
</a>


Code:
........................................................
$em_status = confirm_email($user_email, "Sign Up Verification", $confirm_text, $confirm_link);
......................................................
$em_status returns the result of mail(...), if it's false the function failed.

Get $mailResult from the mail() function like so:

$mailResult = mail($em, $sub, $message, $headers);
return $mailResult;

$mailResult is copied to $em_status, in this case, by calling a function which contains the mail() function:

$em_status = confirm_email($em, $sub, $txt, $link);

So test for a false return. If it is false then format the message content ($message) for your needs and then present the link to the user. When the link is clicked, if there is an active mail agent in the browser, a filled in email form should appear and then all the user needs to do is click their "send" button. Bear in mind you can only send plain text using this option and any urls (if you are sending links) need to be encoded (rawurlencode).

Code:
if(!$em_status) { 
	$confirm_link = "http://greenfloyd.site90.com/_roller.private.php?action=3&confirm_key=" . $confirmKey;
	$confirm_link = rawurlencode($confirm_link);
	$message = "Sign Up Verification: If this is your submission to the greenfloyd Roller~Poster, please click this VERIFY link: $confirm_link";
echo $confirm_link . "<br>";
echo "<p>For some reason internal Email failed.  Please try this \"Plan B\" link instead, it will send an unformatted email to you through your mail service.  Then, from your inbox, click the \"VERIFY\" link in the message  to complete the verification process.<br> Thank you.<hr><a href = 'mailto:".$user_email."?subject=Roller~Poster_Sign_Up&body=".$message."'>plan B</a><hr><a href = 'http://greenfloyd.site90.com/_roller.readerX.php'>[Return]</a><hr>";
} else {
	echo "<p>To activate your new account a confirmation email has been sent to you.  Please click the link in that email to complete the verification process.  Further instructions will be displayed on the confirmation page... enjoy the ride.<hr><a href = 'http://greenfloyd.site90.com/_roller.readerX.php'>[Return]</a><hr>";
			}
Hope that helps.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com