+ Reply to Thread
Results 1 to 3 of 3

Thread: trying to send mail via smtp

  1. #1
    Yet another F-S member
    Join Date
    Apr 2008
    Posts
    44
    Thanks
    4
    Thanked 0 Times in 0 Posts

    trying to send mail via smtp

    i'm using the following code..

    <?php
    require_once "Mail.php";

    $from = "Sandra Sender <sender@example.com>";
    $to = "Ramona Recipient <recipient@example.com>";
    $subject = "Hi!";
    $body = "Hi,\n\nHow are you?";

    $host = "mail.example.com";
    $username = "smtp_username";
    $password = "smtp_password";

    $headers = array ('From' => $from,
    'To' => $to,
    'Subject' => $subject);
    $smtp = Mail::factory('smtp',
    array ('host' => $host,
    'auth' => true,
    'username' => $username,
    'password' => $password));

    $mail = $smtp->send($to, $headers, $body);

    if (PEAR::isError($mail)) {
    echo("<p>" . $mail->getMessage() . "</p>");
    } else {
    echo("<p>Message successfully sent!</p>");
    }
    ?>

    can anyone help me with the details like
    -- smtp username?
    -- smtp password?

  2. #2
    Yet another F-S member
    Join Date
    Sep 2008
    Location
    Scotland, UK
    Posts
    68
    Thanks
    2
    Thanked 3 Times in 3 Posts

    To prevent sites being used/abused to send spam they can't send mail to 3rd party addresses, free-space's sites can only send emails to a free-space webmail account you've setup. So, in the example you've used, you'd need to set up a webmail account for recipient@example.com The smtp username would be recipient+example.com and the password would be whatever password you used for the account.

  3. #3
    Yet another F-S member
    Join Date
    Apr 2008
    Posts
    44
    Thanks
    4
    Thanked 0 Times in 0 Posts

    thanks.. i got it to work.. created an account with free-space and now am able to send mails.. lets hope it works..

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

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