Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jan 2008
    Posts
    216
    Thanks
    10
    Thanked 1 Time in 1 Post

    PHP Mailer (doesnt recognise $email)

    I have managed to get phpmailer working and its sends email fine, but i am trying to use $email for the add address. The $email is the email field in a registration form i am using and i want the email to recognize the address that a user enter at registration, the email is then sent to the address the user has entered. Can anyone help?

    I am using the following code:

    PHP Code:
    require_once('class.phpgmailer.php');
        
    $mail = new PHPGMailer();
        
    $mail->FromName '********';
        
    $mail->AddAddress($email);
        
    $mail->Subject 'This is a test email;
        $mail->Body = '
    This is a test email;
        
    $mail->Send(); 

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    try echoing out $email, and make sure that the value is getting that far.

    like:

    echo $email;
    exit;

  • #3
    Regular Coder
    Join Date
    Jan 2008
    Posts
    216
    Thanks
    10
    Thanked 1 Time in 1 Post
    Quote Originally Posted by angst View Post
    try echoing out $email, and make sure that the value is getting that far.

    like:

    echo $email;
    exit;
    Hey angst i got it working, just needed to include the following 2 lines in the mail script:

    PHP Code:
    $mail->IsSMTP(); // send via SMTP
    $mail->Host 'ssl://smtp.gmail.com'// SMTP servers 
    Thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •