hi daniens i want to send the attachments through authenticated mail in php. so can anyone help me ?? thanks in advance :)

Recommended Answers

All 12 Replies

Help you with what part? What do you have already?

commented: actually i have how to send attachments to mail only. but i want to check that mail id is correct or not, and i dont know what process to do... +1

actually i have how to send attachments to mail only.
but i want to check that mail id is correct or not, and i dont know what process to do...

Can you explain what you want with a piece of code? Am sorry, but I do not understand.

$strTo = $_POST["txtTo"];
$strSubject = $_POST["txtSubject"];
$strMessage = nl2br($_POST["txtDescription"]);


$strSid = md5(uniqid(time()));

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

$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";


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);  

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

from the above code i am uploading my resume and sending to mail, but here i want to check that mail id is valid or not so how can i do that ?

What mail id are you referring to? The email address?

created text boxes in html pages as
1)to mail id:_______
2)from mail id:______
3)upload file:
4) submit.
here am giving to_mail_id as my mail_id and from_mail_id as abc@xyz.com
but am receiving mail from abc@xyz.com
but i want to check the from_mail_id is correct or wrong

How do you want to check it?

i dont know the way how to check the mail, so if u know the solution please can you help me ?

I am trying to figure out what check you want to do. Something like this?

sorry that is checking whether the format is correct or not only.
but i want to check the mail id is original or not...
for example pritaeas@gmail.com is your mail_id and pritaeas@google.com is fake_id...so how to find like which is original_id and which is fake_id??

You can't. You can try sending a message to the address. On some servers you will get a reply that the address doesn't exists. On the other hand, some servers don't do that. Even when they do, it may still be a valid email address belonging to somebody else. You cannot distinguish between those.

commented: thanQ Pritaeas +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.