Anyone please help me?

the mail() function

Moderators: egami, macek, gesf

Post Reply
User avatar
bigjoe11a
New php-forum User
New php-forum User
Posts: 137
Joined: Wed Aug 31, 2011 3:55 am
Location: USA
Contact:

Sun Jan 29, 2012 6:55 pm

Ok, for one thing you can't run the code like this. Try using a function instead.

Code: Select all


function SendMsg($to)

$mailto = $to;
$subject = 'Your new account';
$message = 'A new account has been setup. We look forward to serving your investment needs.';
$message .= "\r\nUsername: ";
$message .= $newusername;
$message .= "\r\n";
$header = "From: admin@yahoo.com"."\r\n";
$header .= "Reply-To: admin@yahoo.com"."\r\n";
$header .= "MIME-Version: 1.0"."\r\n";
$header .= "Content-Type: text/plain; charset=utf-8"."\r\n";
$header .= "Content-Transfer-Encoding: 8bit"."\r\n";
$header .= "X-Mailer: PHP v".phpversion();

mail ($mailto, $subject, $body, $headers);

To use this function you would do some thing this.

Code: Select all

SendMsg("admin@yahoo.com");
// or send another
SendMsg("admin@google.com");

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests