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

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.