I have a program to run through a database data which has email address and a filename for the email address.
The task is to attach the file as specified in the filename to the email address.
I am having problem with my program where by it attached 1 file for the first email, 2 files for the 2nd and 3 files for the 3rd. Obviously, the problem comes from the fact that files kept on being added to the message but the old file for previous email wasn't removed.
So my question is, how do i remove the other files that I attached earlier for other emails.
I have a loop to run through all email address
prepare message
loop while still have email address to send
attach file for this email
send out email
end
what i need is to remove the attachment after i sent out the email, but how do i achieve that?
Thanks in advance
Kelvin
how to remove attachment
Moderators: Chris Corbyn, General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: how to remove attachment
Code: Select all
$id = $message->attach($attachment);
$message->detach($id);Re: how to remove attachment
thanks mate, some how i missed that function when I search through the doc.