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

Thread: Send Mail from Diffenet Account PHP

  1. #1
    darkpunkcalob is offline x10Hosting Member darkpunkcalob is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    22

    Send Mail from Diffenet Account PHP

    So, I have my mail script out and fine, it works, but it sends the mail from my user@boru.x10hosting.com... I need it to come from my user@domain.co.cc mail account.

    I know there is a way to change it from the php.ini file, but I dont have access to that, so is there a feature of code im missing to do this?

  2. #2
    lemon-tree's Avatar
    lemon-tree is offline x10 Minion lemon-tree has a spectacular aura about
    Join Date
    Nov 2007
    Posts
    1,420

    Re: Send Mail from Diffenet Account PHP

    PHP Code:
    <?php
    $to      
    'nobody@example.com';
    $subject 'the subject';
    $message 'hello';
    $headers 'From: webmaster@example.com' "\r\n" .
        
    'Reply-To: webmaster@example.com' "\r\n" .
        
    'X-Mailer: PHP/' phpversion();

    mail($to$subject$message$headers);
    ?>
    Use the $headers variable to control the address the email originates from. Copied straight from here

  3. #3
    darkpunkcalob is offline x10Hosting Member darkpunkcalob is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    22

    Re: Send Mail from Diffenet Account PHP

    Quote Originally Posted by lemon-tree View Post
    PHP Code:
    <?php
    $to      
    'nobody@example.com';
    $subject 'the subject';
    $message 'hello';
    $headers 'From: webmaster@example.com' "\r\n" .
        
    'Reply-To: webmaster@example.com' "\r\n" .
        
    'X-Mailer: PHP/' phpversion();

    mail($to$subject$message$headers);
    ?>
    Use the $headers variable to control the address the email originates from. Copied straight from here

    Thanks, but tried that, still comes up as user@boru.x10hosting.com

  4. #4
    DeadBattery's Avatar
    DeadBattery is offline Community Support Team DeadBattery is a name known to allDeadBattery is a name known to all
    Join Date
    Mar 2008
    Location
    localhost
    Posts
    4,019

    Re: Send Mail from Diffenet Account PHP

    PHP Code:
    <?php
    $to 
    'youremail@x10email.com'/*change this to your email*/
    $subject 'the subject';
    $message 'hello';
    $headers 'From: user@domain.co.cc' "\r\n" .
        
    'Reply-To: user@domain.co.cc' "\r\n" .
        
    'X-Mailer: PHP/' phpversion();

    mail($to$subject$message$headers);
    ?>
    Try uploading that as a PHP file (editing the top email address) and loading it. It should send you an email.
    (I just put changed a couple values from lemon-tree's post.


  5. #5
    gichan is offline x10Hosting Member gichan is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    64

    Re: Send Mail from Diffenet Account PHP

    By adding from address to header you cannot change the address of sending the mail. It just add a email header. But it will show the recipient as the email was sent from the address you entered to the header. But really the email will sent from the address: user@server.x10hosting.com

  6. #6
    adityain is offline x10Hosting Member adityain is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    6

    Re: Send Mail from Diffenet Account PHP

    header thing does work?

  7. #7
    darkpunkcalob is offline x10Hosting Member darkpunkcalob is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    22

    Re: Send Mail from Diffenet Account PHP

    The header doesn't work btw, and yeah, i want to change where its coming from, not where to to reply to.

  8. #8
    DeadBattery's Avatar
    DeadBattery is offline Community Support Team DeadBattery is a name known to allDeadBattery is a name known to all
    Join Date
    Mar 2008
    Location
    localhost
    Posts
    4,019

    Re: Send Mail from Diffenet Account PHP

    As you said, the mail() method falsifies the From address; it won't always be right.
    The only way to make it work is to connect to an email account and send an email. I'm not sure if there is a way to do that or not.


  9. #9
    fortwienix is offline x10Hosting Member fortwienix is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    9

    Re: Send Mail from Diffenet Account PHP

    try to do
    PHP Code:
    ini_set('sendmail_from''me@domain.com'); 
    and optional:
    PHP Code:
    ini_set("SMTP","smtp.domain.com" ); 
    before calling mail(). If that doesn't work, you can make an SMTP connect to the server where your mail account is hosted. That needs of course username and password in your script that is opening the connection.

  10. #10
    darkpunkcalob is offline x10Hosting Member darkpunkcalob is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    22

    Re: Send Mail from Diffenet Account PHP

    Quote Originally Posted by fortwienix View Post
    try to do
    PHP Code:
    ini_set('sendmail_from''me@domain.com'); 
    and optional:
    PHP Code:
    ini_set("SMTP","smtp.domain.com" ); 
    before calling mail(). If that doesn't work, you can make an SMTP connect to the server where your mail account is hosted. That needs of course username and password in your script that is opening the connection.

    That didnt work either

    Here is the complete script:

    HTML Code:
    <html>
    <title>SMS System | SMS Sent</title>
    <head>
    <style type="text/css">
    body {background-color: black; color: white}
    a {color: red}
    p {margin-left: 20px}
    </style>
    </head>
    <body>
    <center>
    <?php
    
    if ($_POST["carriers"] == "vtext") $to = $_POST["num"]."@vtext.com";
    
    if ($_POST["carriers"] == "att") $to = $_POST["num"]."@txt.att.net";
    
    if ($_POST["carriers"] == "lilman") $to = $_POST["num"]."@cingularme.com";
    
    if ($_POST["carriers"] == "next") $to = $_POST["num"]."@messaging.nextel.com";
    
    if ($_POST["carriers"] == "tmo") $to = $_POST["num"]."@tmomail.net";
    
    if ($_POST["carriers"] == "rtb") $to = $_POST["num"]."@messaging.sprintpcs.com";
    
    if ($_POST["carriers"] == "bst") $to = $_POST["num"]."@myboostmobile.com";
    
    if ($_POST["carriers"] == "vdf") $to = $_POST["num"]."@sms.vodafone.it";
    
    $subject = "";
    $from = "sms-noreply@darkjournal.co.cc";
    $message = $_POST["mess"];
    $headers = 'From: sms-noreply@darkjournal.co.cc' . "\r\n" .
        'X-Mailer: PHP/' . phpversion(); 
    ini_set('sendmail_from', 'sms-noreply@darkjournal.co.cc');
    mail($to,$subject,$message);
    
    ?>
    <h1>SMS Sent!</h1><br>
    <a href="http://darkjournal.co.cc/start-sms.php">Go Back to Home</a>
    </center>
    </body>
    </html>

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Mail Issues
    By Corey in forum News and Announcements
    Replies: 9
    Last Post: 11-20-2009, 02:09 PM
  2. imap issues on windows mail... cannot send email
    By enever in forum Free Hosting
    Replies: 6
    Last Post: 03-04-2008, 04:34 PM
  3. PHP Mail Code Problem
    By Swiblet in forum Free Hosting
    Replies: 2
    Last Post: 11-04-2007, 09:57 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