Creating a Email with IMAP

Discussion in 'PHP' started by webboy, Apr 8, 2011.

  1. #1
    Hi All i wish to create email in the inbox flder or any folder then move it to inbox as a new message using IMAP , i dont wish to send it to the mail account as the ISP is limiting the amount of message sent out

    Can this be done i have found this code but it dose not create the email


    $stream = imap_open('{mail.mydomain.com:993/ssl/novalidate-cert}INBOX', "email@mydomain.com", "xxxxx");

    $check = imap_check($stream);
    echo "Msg Count before append: ". $check->Nmsgs . "\n";

    print_r (imap_list());

    imap_append($stream, "{mail.mydomain.com:993/ssl/novalidate-cert}INBOX"
    , "From: \r\n"
    . "To: \r\n"
    . "Subject: test\r\n"
    . "\r\n"
    . "this is a test message, please ignore\r\n"
    );
    print_r(imap_errors());

    $check = imap_check($stream);
    echo "Msg Count after append : ". $check->Nmsgs . "\n";

    imap_close($stream);
     
    webboy, Apr 8, 2011 IP