+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Use PHPMailer to send message to self

  1. #1
    ellescuba27 is online now x10 Sophmore ellescuba27 is an unknown quantity at this point
    Join Date
    Sep 2011
    Posts
    150

    Use PHPMailer to send message to self

    Don't know if this can be done or not.

    I am using PHPMailer to send emails (I am aware of the 100 email limit).
    I want to be able to use smtp to send messages to myself using PHPMailer. Basically, I am making a newspaper that anyone at my school can edit and I want to have a flag button for inappropriate content. I want to get email updates when someone flags an article so I can review it. But I don't want to have to have people to email me from their own email to alert me. I want the email to be automatically sent without a login, and I prefer not to use mailto: . So I use PHPMailer and have it email myself messages so that no user login is required (the site does it for you). However, while it says there is no error, I am not receiving the messages in Roundcube.

    Here is my code:
    Here I have a function to send mail:
    PHP Code:
    <?php
    require_once('phpmailer/class.phpmailer.php');
    $error null;
    function 
    smtpmailer($to$subject$message$winerror$failerror) {
    global 
    $error;
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->Host "mail.(website blocked)";
    $mail->SMTPDebug 1;
    $mail->SMTPAuth true;
    $mail->Port 25;
    $mail->Username "(username blocked)";
    $mail->Password "(password blocked)";
    $mail->SetFrom('(email blocked)''(website blocked)');
    $mail->AddReplyTo("(email blocked)","(website blocked)");
    $mail->Subject $subject;
    $mail->Body $message;
    $mail->AddAddress($to"Our Friend");
    if(!
    $mail->Send()) {
    $error true;
    echo 
    $failerror;
    } else {
    $error false;
    echo 
    $winerror;
    }
    }
    ?>
    For a fact, I know this function works. I have tested it with other people and they recieved it fine. But when sending to myself, it didn't work. Here is how I called the function:
    PHP Code:
    smtpmailer("(email blocked)""FLAG""Here is why the article was flagged""A message has been sent to the admins telling them to check on this article. Well done!""The article was flagged. It may take a while for the admins to find it, as there was an error when the email was sent."); 
    When I send the mail, I get $winerror as the error message, so no error happened. But I don't receive any emails! I checked my junk too. So what's wrong??

  2. #2
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: Use PHPMailer to send message to self

    So you are using x10hosting's SMTP or a third party?

    You are sending it FROM "george@igor.x10.bz" TO "george@igor.x10.bz" ?
    Nothing is always absolutely so.

  3. #3
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Use PHPMailer to send message to self

    Try setting $mail->SMTPDebug = 2; to get more information from PHPMailer. The higher the number, the more information will be shown (though 4 looks to be the largest debug level). You can also edit phpmailer::smtp_send to dump $smtp->error (if any) after each call to an SMTP method.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  4. #4
    thapsangnganha95 is offline x10Hosting Member thapsangnganha95 is an unknown quantity at this point
    Join Date
    Nov 2011
    Posts
    13

    Re: Use PHPMailer to send message to self

    thanks for shared ^^

  5. #5
    ellescuba27 is online now x10 Sophmore ellescuba27 is an unknown quantity at this point
    Join Date
    Sep 2011
    Posts
    150

    Re: Use PHPMailer to send message to self

    @descalzo using x10hosting's SMTP (username)@(subdomain name). And yes, FROM and To is same address.
    PHPMailer link: phpmailer.worxware.com
    @misson will try.

    ---------- Post added at 04:29 PM ---------- Previous post was at 04:20 PM ----------

    I set SMTP_Debug to 4. I'll just paste the FROM_SERVER parts, as I feel like anything else might be revealing dangerous information (I see some IP Addresses, and some codes which are usually meant to hide something):
    SMTP -> FROM SERVER:220-boru.x10hosting.com ESMTP Exim 4.69 #1 Sun, 27 Nov 2011 11:22:36 -0500 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
    SMTP -> FROM SERVER: 250-boru.x10hosting.com Hello boru.x10hosting.com [(blocked IP address)] 250-SIZE (blocked random code) 250-PIPELINING 250-AUTH PLAIN LOGIN 250-STARTTLS 250 HELP
    SMTP -> FROM SERVER:250 OK
    SMTP -> FROM SERVER:250 Accepted
    SMTP -> FROM SERVER:354 Enter message, ending with "." on a line by itself
    SMTP -> FROM SERVER:250 OK id=(blocked id)
    Everything going fine?
    Last edited by ellescuba27; 11-27-2011 at 10:30 AM. Reason: Misspelled a username

  6. #6
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: Use PHPMailer to send message to self

    Can you receive mail on that account from outside?
    Nothing is always absolutely so.

  7. #7
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Use PHPMailer to send message to self

    Very little of the SMTP conversation contains sensitive information. IP addresses are generally the addresses of the servers, which are a matter of public record (DNS records, in particular). The number after SIZE is the size of the message. Mostly, we want to see whether there are any error response codes (4XX or 5XX), but there appear to be none, which means boru.x10hosting.com accepted the e-mail for delivery. What happens when you send an e-mail to the X10 account from an account on another host?
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  8. #8
    ellescuba27 is online now x10 Sophmore ellescuba27 is an unknown quantity at this point
    Join Date
    Sep 2011
    Posts
    150

    Re: Use PHPMailer to send message to self

    Oops so apparently it's not a problem with PHPMailer, Roundcube isn't receiving any mail. I sent from my Gmail with no luck.

    And it sends emails to other people just fine.
    Last edited by ellescuba27; 11-28-2011 at 05:51 PM.

  9. #9
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Use PHPMailer to send message to self

    It might not so much be RoundCube as the mail account. Try setting up a POP3 or IMAP client (cPanel will give you the configuration). Alternatively, you can use Google Apps for mail hosting rather than X10.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  10. #10
    ellescuba27 is online now x10 Sophmore ellescuba27 is an unknown quantity at this point
    Join Date
    Sep 2011
    Posts
    150

    Re: Use PHPMailer to send message to self

    Hi,
    the incoming mail server port is 110, right?

    ---------- Post added at 12:16 AM ---------- Previous post was at 12:06 AM ----------

    Yes, it is 110. Thanks for your help misson, it works like a dream!

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. PHP PM send message help
    By as4s1n in forum Programming Help
    Replies: 3
    Last Post: 04-05-2010, 09:33 PM
  2. best PHPmailer available?
    By magsrose in forum Programming Help
    Replies: 1
    Last Post: 07-19-2008, 11:41 PM
  3. send a chat message for 5 credits
    By TPI007 in forum The Marketplace
    Replies: 9
    Last Post: 07-19-2008, 07:28 PM
  4. phpFreeChat You must be connected to send a message
    By tittat in forum Scripts & 3rd Party Apps
    Replies: 0
    Last Post: 05-10-2008, 01:19 PM
  5. help on phpmailer
    By lohmeyer in forum Programming Help
    Replies: 5
    Last Post: 01-15-2008, 08:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers