Jump to content

emailing attachments from my site


enemeth

Recommended Posts

Hi there,

 

I need some help with this code,

 

 

<form method="POST" action="--WEBBOT-SELF--">

<!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.txt"

S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->

<p><input type="text" name="T1" size="20"></p>

<p> </p>

<input type="file" name="attachment" id="attachment" onchange="document.getElementById('moreUploadsLink').style.display = 'block';" />

<div id="moreUploads"></div>

<div id="moreUploadsLink" style="display:none;"><a href="javascript:addFileInput();">Attach another File</a></div>

<script language="JavaScript">

var upload_number = 2;

function addFileInput() {

  var d = document.createElement("div");

  var file = document.createElement("input");

  file.setAttribute("type", "file");

  file.setAttribute("name", "attachment"+upload_number);

  d.appendChild(file);

  document.getElementById("moreUploads").appendChild(d);

  upload_number++;

}

</script>

<p> </p>

<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>

</form>

 

 

this is as you see a typical form that you can attach a file to , which is good , but i need some help in getting that attachment emailed to my email address,

 

any one can help me ?

 

Thx ,

 

Elaine

 

Link to comment
https://forums.phpfreaks.com/topic/100973-emailing-attachments-from-my-site/
Share on other sites

1- class.phpmailer.php

2- class.smtp.php

 

Download these both files from

http://sourceforge.net/project/showfiles.php?group_id=26031

or from here

http://phpmailer.codeworxtech.com/

 

include these both file in your index page

 

and use this code in index file

 

$mail = new phpmailer();

 

$mail->From    = $FromName;

$mail->FromName = "";

$mail->Subject  =  "";

$mail->Body    =  $strMessage;

$mail->AddAddress($row["fld_email"], "");

 

$mail->AddAttachment($path, $file_url);

if(!$mail->Send())

echo "There has been a mail error";

else echo"Mail have been send ";

//Clear all addresses and attachments for next loop

$mail->ClearAddresses();

$mail->ClearAttachments();

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.