Jump to content


Photo

mail() with attachments


  • Please log in to reply
3 replies to this topic

#1 pshankland

pshankland
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 15 March 2006 - 09:53 PM

I have got the following VERY basic script:

<?php
$to = 'somone@somewhere.com';
$subject = 'Some Subject';
$message = 'Some Message';

mail($to, $subject, $message, '', '-fsomeoneelse@domain.com');
?>

This works but I need to be able to send a *.sql file as an attachment and although there is lots of help on the net I am a bit stuck. Anyone give me a simple addon to this script for me to mail the attachment? I have looked and can't use the phpmailer class as don't have the ability edit the php.ini file on my hosted server.

Also, I would like to have the current date within the subject, how can I do this?

Thanks.

#2 dootch

dootch
  • Members
  • Pip
  • Newbie
  • 8 posts

Posted 15 March 2006 - 10:59 PM

html mime mail [a href=\"http://www.phpguru.org/static/mime.mail.html\" target=\"_blank\"]http://www.phpguru.org/static/mime.mail.html[/a] download and check out examples I got it to work no problem


[!--quoteo(post=355494:date=Mar 15 2006, 02:53 PM:name=pshankland)--][div class=\'quotetop\']QUOTE(pshankland @ Mar 15 2006, 02:53 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I have got the following VERY basic script:

<?php
$to = 'somone@somewhere.com';
$subject = 'Some Subject';
$message = 'Some Message';

mail($to, $subject, $message, '', '-fsomeoneelse@domain.com');
?>

This works but I need to be able to send a *.sql file as an attachment and although there is lots of help on the net I am a bit stuck. Anyone give me a simple addon to this script for me to mail the attachment? I have looked and can't use the phpmailer class as don't have the ability edit the php.ini file on my hosted server.

Also, I would like to have the current date within the subject, how can I do this?

Thanks.
[/quote]


#3 keeB

keeB
  • Staff Alumni
  • Advanced Member
  • 1,078 posts
  • LocationCalifornia

Posted 16 March 2006 - 01:10 AM

<?php
 $date = date("d m Y");
print $date;
?>

Come visit my site to see my latest projects
http://nick.stinemates.org/wordpress/


#4 pshankland

pshankland
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 16 March 2006 - 07:21 PM

Thanks for the help both,will try out now :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users