openSUSE Forums > Programming/Scripting » mail function from php

Go Back   openSUSE Forums > Programming/Scripting
Forums FAQ Members List Search Today's Posts Mark Forums Read


Programming/Scripting Questions about programming, bash scripts, perl, php, cron jobs, ruby, python, etc.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 30-Aug-2009, 14:34
agunet74's Avatar
Explorer Penguin
 
Join Date: Dec 2008
Location: Montevideo, Uruguay
Posts: 131
agunet74 hasn't been rated much yet
Question mail function from php

Hi there,

I'm trying to use the mail function from php. At this point I am sending them (the mails) to my e-mail accounts.

I run the program but nothing happens. Any suggestion ? IS apache has something to do with this ?

I copy-paste my simple program of mail:


<html>
<head>
<title>Correos</title>
</head>
<body>
<?php
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$mail = "*****@***.**"; //I don't write for spam reasons, but the mail account is right

for ($i=1;$i<=5;$i++){
mail($mail,'Test','5 mails to the same e-mail box', $headers);
echo "Sending mail number $i <br> \n ";
}
?>
</body>
</html>


Thanks for help

Best regards

agunet74
__________________
Turbo 3000+ | 1593,57 MHz | 979 MB RAM |
HARD DISK 40G Media | System: openSUSE 11.1 (i586) | KDE: 4.2 "release 1"
Reply With Quote
  #2 (permalink)  
Old 30-Aug-2009, 17:27
Flux Capacitor Penguin
 
Join Date: Jun 2008
Location: GMT+10
Posts: 5,230
ken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud of
Default Re: mail function from php

See here: PHP mail() Function which says about the headers argument:

Note: When sending an email, it must contain a From header. This can be set with this parameter or in the php.ini file.al.
Reply With Quote
  #3 (permalink)  
Old 30-Aug-2009, 22:34
agunet74's Avatar
Explorer Penguin
 
Join Date: Dec 2008
Location: Montevideo, Uruguay
Posts: 131
agunet74 hasn't been rated much yet
Default Re: mail function from php

I copy those headers arguments, add the from to php ini and still not working.

in the program if I write it in the headers variable, like this:

headers = "******@****.***" . "\r\n";
heraders .= "charset.. and other sutff I copied literall

I don't know.. bou it's not working

Thanks anyway

any other help will be very welcome!

agunet74
__________________
Turbo 3000+ | 1593,57 MHz | 979 MB RAM |
HARD DISK 40G Media | System: openSUSE 11.1 (i586) | KDE: 4.2 "release 1"
Reply With Quote
  #4 (permalink)  
Old 30-Aug-2009, 22:42
Flux Capacitor Penguin
 
Join Date: Jun 2008
Location: GMT+10
Posts: 5,230
ken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud of
Default Re: mail function from php

Here's a call from a webapp I wrote:

Quote:
mail($to, $subject, $message, 'From: ' . REPLY_TO . "\r\n" . 'Reply-To: ' . DO_NOT_REPLY . "\r\n" . 'Content-type: text/plain; charset="utf-8"');
REPLY_TO and DO_NOT_REPLY are constants in my webapp, set to the appropriate mail addresses for the webapp.
Reply With Quote
Reply

Bookmarks

Tags
php mail


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2