Jump to content

Emailed attachments are empty


jaypotter

Recommended Posts

Thanks for the quick reply.

 

I use this code to call the function.

 

share_email_send('[email protected]','Jay Potter','[email protected]','message','test','[email protected]',$t_reserves_path,'test.php') ;

 

and here is the function code, which uses class.phpmailer.php. I hope class.phpmailer.php is a fairly standard class used throughout the PHP world.

 

 

# --------------------

# This function sends an email message based on the supplied email data.

function share_email_send($t_Recipient,$t_FromName,$t_FromAddress,$t_Message,$t_Subject,$t_Recipient2='[email protected]',$t_path = '',$t_attachment='') {

global $g_phpMailer_smtp;

 

$mail = new PHPMailer;

 

$mail->From    = $t_FromAddress ;

$mail->Sender  = $t_Recipient ;

$mail->cc = '[email protected]';

$mail->FromName = $t_FromName ;

$mail->Subject = $t_Subject ;

$mail->Body = $t_Message ;

 

$mail->PluginDir = $t_phpmailer_path;

$mail->Hostname = '127.0.0.1';

$mail->SetLanguage( 'en' );

$mail->IsHTML( false );              # set email format to plain text

$mail->WordWrap = 80;              # set word wrap to 50 characters

$mail->Priority = '3' ;  # Urgent = 1, Not Urgent = 5, Disable = 0

$mail->CharSet = 'utf-8';

$mail->Host    = 'mail.agne.com';

 

$mail->AddAddress( $t_Recipient, '' );

$mail->AddAddress( $t_Recipient2, '' );

 

$t_Message = $t_Message . ' attachment ' . $t_attachment;

 

if($t_attachment != ''){

 

$t_Message = $t_Message . ' tried attachment' ;

 

$mail->AddAttachment($t_path, $t_attachment) ;

 

$t_Message = $t_Message . $mail->ErrorInfo ;

 

}

 

$mail->Body = $t_Message ;

 

# SMTP collection is always kept alive

#

$mail->SMTPKeepAlive = true;

 

if( is_null( $g_phpMailer_smtp ) )  {

# register_shutdown_function( 'email_smtp_close' );

} else {

$mail->smtp = $g_phpMailer_smtp;

}

 

if ( !$mail->Send() ) {

$t_success = false;

} else {

$t_success = true;

}

 

return $t_success;

}

 

 

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.