php - Send attachment file using PHPMailer -


here code using phpmailer send attachment via mail using phpmailer. try out in localhost function perfectly. once upload server, attachment not sent.

$email = new phpmailer(); $email->from      = 'john@hotmail.com'; $email->fromname  = 'john'; $email->subject   = 'message subject'; $email->body      = 'test'; $email->addaddress( 'william@hotmail.com' );  $file_to_attach = $_files["cv"]["tmp_name"];  $email->addattachment( $file_to_attach , $_files["cv"]["name"]);  return $email->send(); 

i cant receive attachment file , upload.

did miss out code..?

there's nothing wrong code - works fine on localhost (and me), must issue server environment. several things:

windows server no mail server installed? permissions uploaded files, or indeed ability upload files @ all, since controlled via php.ini.

i suggest separate out stages:

  • upload file , save it, check it's there on server.

  • check php script can see , read uploaded file (and please read docs on how correctly).

  • send simple email without attachments. if works know mail server ok.

when individual pieces working, join them together.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -