You can use the PHP mail() function to send an email with PHP


  • Problems

    This line enable URL Rewriting . It must be enabled via the RewriteEngine directive! and if your .htaccess file is going to use rewrite rules, you should always include this line. Otherwise, you can’t be sure if its enabled or not. The string “on” is case insensitive.

Function     Description
ezmlm_hash() ->    Calculates the hash value needed by EZMLM
mail()  ->   Allows you to send emails directly from a script


MAIL():

Syntax

mail(to,subject,message,headers,parameters);

Parameter Description
to Required. Specifies the receiver / receivers of the email
subject Required. Specifies the subject of the email. Note: This parameter cannot contain any newline characters
message Required. Defines the message to be sent. Each line should be separated with a LF (\n). Lines should not exceed 70 characters. Windows note: If a full stop is found on the beginning of a line in the message, it might be removed. To solve this problem, replace the full stop with a double dot:
<?php
$txt = str_replace("\n.", "\n..", $txt);
?>
headers Optional. Specifies additional headers, like From, Cc, and Bcc. The additional headers should be separated with a CRLF (\r\n). Note: When sending an email, it must contain a From header. This can be set with this parameter or in the php.ini file.
parameters Optional. Specifies an additional parameter to the sendmail program (the one defined in the sendmail_path configuration setting). (i.e. this can be used to set the envelope sender address when using sendmail with the -f sendmail option)

Simple code to sent e-mail directly from your script


<?php
// the message
$masg = "body of e-mail";



// send email
mail("someone@example.com","My subject",$msg);
?>





















No comments:

Post a Comment