mail not sending

Discussion in 'PHP' started by promotingspace.net, Mar 30, 2008.

  1. #1
    Hi
    The mail function i'm writing is not being sent. can yuo guess why?
    thanks
    the code:
    
    $subject = "site raygane pasargad. Your card details";
    $message="ba estefade az moshakhasate zir mitavanid da adrese http://rooyekhat4u.com/sitesaz/wizard.php yek website baraye khod besazid ke be modate 2 mah etebar khahad dasht. bad az 2 mah, shoma mitavanid ba sharje mablaghe nachize mahiane 2500 tuman etebare site khod ra tamdid konid \n\n";
    $message.="serial:".$serial."/n/n";
    $message.="Username:".$card."/n/n";
    $message.="Password:".$pass."/n/n";
    $message.="Ba tashakor/n/n Serkat Rooyekhate Pasargad (rooyekhat4u.com)";
    $from = "info@rooyekhat4u.com";
    $headers = "From: $from";
    mail($email,$subject,$message,$headers);
    PHP:

     
    promotingspace.net, Mar 30, 2008 IP
  2. Xtrm2Matt

    Xtrm2Matt Active Member

    Messages:
    129
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Cooked this up for you:

    <?php
    // Test Variables
    $email = "matt@aruarose.com";
    $serial = "serial";
    $card = "card";
    $pass = "pass";
    
    // Subject
    $subject	 =	"site raygane pasargad. Your card details";
    
    // Content
    $content	 =	"ba estefade az moshakhasate zir mitavanid da adrese http://rooyekhat4u.com/sitesaz/wizard.php yek website baraye khod besazid ke be modate 2 mah etebar khahad dasht. bad az 2 mah, shoma mitavanid ba sharje mablaghe nachize mahiane 2500 tuman etebare site khod ra tamdid konid<br /><br />";
    $content	.=	"Serial: $serial<br /><br />";
    $content	.=	"Username: $card<br /><br />";
    $content	.=	"Password: $pass<br /><br />";
    $content	.=	"Ba tashakor/n/n Serkat Rooyekhate Pasargad (rooyekhat4u.com)";
    
    // Email headers
    $headers	 = "Content-Type: text/html\n";
    $headers	.= "From: info@rooyekhat4u.com <info@rooyekhat4u.com>\n";
    $headers	.= "Reply-To: info@rooyekhat4u.com <info@rooyekhat4u.com>\n";
    
    // Send the email!
    mail( $email, $subject, $content, $headers );
    ?>
    PHP:
    I tested yours, and you're right that it doesn't send an email. I'm guessing it's because you messed the headers up, but I didn't test it too much, just ripped the one I use apart for you.

    Hope it helps :)
     
    Xtrm2Matt, Mar 30, 2008 IP
  3. promotingspace.net

    promotingspace.net Peon

    Messages:
    361
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thank you very much Xtrm2Matt
     
    promotingspace.net, Mar 30, 2008 IP
  4. Xtrm2Matt

    Xtrm2Matt Active Member

    Messages:
    129
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #4
    My pleasure, glad I could help :)
     
    Xtrm2Matt, Mar 30, 2008 IP
  5. jasonus

    jasonus Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    <%
    Function sendGMail()

    on error resume next

    Set myMail=CreateObject("CDO.Message")
    myMail.From="jasonus@gmail.com.com"
    myMail.Subject="Sending email with CDO"
    myMail.To="jasonus@gmail.com"
    myMail.TextBody="This is a message."
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="smtp.gmail.com"
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") =1
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "XXXX@gmail.com"
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "XXX"
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =465
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 ' authenticate
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true 'Use SSL for the connection
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

    myMail.Configuration.Fields.Update
    myMail.Send
    end Function
    %>
     
    jasonus, Jul 11, 2008 IP