PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 30th, 2012, 02:34 PM
asifbhura asifbhura is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 10 asifbhura User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 25 sec
Reputation Power: 0
Email is not working

Hello

it runs correctly even i recieve message "Mail send completed"

but, I dont recieve any email(s).

Please help me out

regards,


<?php


$host = "mail.ayyooo.com";
$username = "username";
$password = "password";

$strTo = test@ayyooo.com'; //$_POST["txtTo"];
$strSubject ='CV details From ' . $_POST["email0"];
$strMessage = 'First Name: ' . $_POST["firstName"] . "\n\n";
$strMessage .= 'Middle Name: ' . $_POST["middleName"] . "\n\n";
$strMessage .= 'Last Name: ' . $_POST["lastName"] . "\n\n";
$strMessage .= 'Applying for Position: ' . $_POST["position"] . "\n\n";
$strMessage .= 'Town: ' . $_POST["town"] . "\n\n";
$strMessage .= 'City: ' . $_POST["City"] . "\n\n";
$strMessage .= 'Country: ' . $_POST["Country"] . "\n\n";
$strMessage .= 'Telephone: ' . $_POST["tel"] . "\n\n";
$strMessage .= 'Email: ' . $_POST["email0"] . "\n\n";
$strMessage .= 'Year of Exp.: ' . $_POST["exp"] . "\n\n";
$strMessage .= 'Comments: ' . $_POST["comments"] . "\n\n";

//nl2br($_POST["txtDescription"]);

//*** Uniqid Session ***//
$strSid = md5(uniqid(time()));

$strHeader = "";
$strHeader .= "From: ".$_POST["firstName"]."<".$_POST["email0"].">\nReply-To: ".$_POST["email0"]."";

$strHeader .= "MIME-Version: 1.0\n";
$strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n";
$strHeader .= "This is a multi-part message in MIME format.\n";

$strHeader .= "--".$strSid."\n";
$strHeader .= "Content-type: text/html; charset=utf-8\n";
$strHeader .= "Content-Transfer-Encoding: 7bit\n\n";
$strHeader .= $strMessage."\n\n";

//*** Attachment ***//
if($_FILES["fileAttach"]["name"] != "")
{
$strFilesName = $_FILES["fileAttach"]["name"];
$strContent = chunk_split(base64_encode(file_get_contents($_FILES["fileAttach"]["tmp_name"])));
$strHeader .= "--".$strSid."\n";
$strHeader .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"\n";
$strHeader .= "Content-Transfer-Encoding: base64\n";
$strHeader .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"\n\n";
$strHeader .= $strContent."\n\n";
}

$flgSend = @mail($strTo,$strSubject,null,$strHeader);
// @ = No Show Error //

if($flgSend)
{
echo "Mail sent completed.";
}
else
{
echo "Cannot send mail.";
}
?>

Reply With Quote
  #2  
Old December 30th, 2012, 03:18 PM
navnav's Avatar
navnav navnav is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Location: Oxford, United Kingdom
Posts: 40 navnav User rank is Private First Class (20 - 50 Reputation Level)navnav User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 2 h 18 m 23 sec
Reputation Power: 1
Send a message via Skype to navnav
You've clearly copied that code from the net. If you hadn't, you wouldn't be suppressing errors:
PHP Code:
 $flgSend = @mail($strTo,$strSubject,null,$strHeader);
 
// @ = No Show Error // 

Remove the '@'. Then see if you get any errors/warnings.

Are you testing this on a local server (XAMP, MAMP , etc)? If so, that's your problem. Try it on a remote server or use Mercury.

You should also use a class that can make things a lot easier for this kind of task. PHPMailer perhaps?

EDIT: Also, please wrap your PHP code in [ PHP ][ /PHP ] (ignore spaces) tags.

Reply With Quote
  #3  
Old December 30th, 2012, 11:11 PM
asifbhura asifbhura is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 10 asifbhura User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 25 sec
Reputation Power: 0
hello,

I have already tried with that,

but Same result, actually it doesnt attach file.

Regards,

Reply With Quote
  #4  
Old December 30th, 2012, 11:15 PM
navnav's Avatar
navnav navnav is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Location: Oxford, United Kingdom
Posts: 40 navnav User rank is Private First Class (20 - 50 Reputation Level)navnav User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 2 h 18 m 23 sec
Reputation Power: 1
Send a message via Skype to navnav
Okay, so with PHPMailer, you fail to attach the file correctly? But does the email actually arrive? If so, post the code using PHPMailer. I'll have a look xD

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Email is not working

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap