Viewed   62 times

I'm trying to create a php script that will handle a mailing list for me using a mySQL database, and I have most of it in place. Unfortunately, I can't seem to get the headers to work right, and I'm not sure what the problem is.

$headers='From: noreply@rilburskryler.net rn';
$headers.='Reply-To: noreply@rilburskryler.netrn';
$headers.='X-Mailer: PHP/' . phpversion().'rn';
$headers.= 'MIME-Version: 1.0' . "rn";
$headers.= 'Content-type: text/html; charset=iso-8859-1 rn';
$headers.= "BCC: $emailList";

The result I'm getting on the recieving end is:

"noreply"@rilburskryler.net rnReply-To: noreply@rilburskryler.netrnX-Mailer: PHP/5.2.13rnMIME-Version: 1.0

 Answers

5

To have names, as opposed to email addresses shown, use the following:

"John Smith" <johnsemail@hisserver.com>

Easy.

Regarding the broken line breaks, that is because you are enclosing the text in apostrophes rather than quotation marks:

$headers = array(
  'From: "The Sending Name" <noreply@rilburskryler.net>' ,
  'Reply-To: "The Reply To Name" <noreply@rilburskryler.net>' ,
  'X-Mailer: PHP/' . phpversion() ,
  'MIME-Version: 1.0' ,
  'Content-type: text/html; charset=iso-8859-1' ,
  'BCC: ' . $emailList
);
$headers = implode( "rn" , $headers );
Sunday, December 25, 2022
5

Yes, it's possible, and no, you probably won't get a higher spam score. Any header beginning with 'X-' is a legitimate extended header. There are many of these, having to do with spam filtering software, email distribution lists, etc.

Having an extended header is not prima facie evidence of being spam.

But are you sure you don't want to use the In-Reply-To header or the existing unique message IDs (Message-ID) to build a thread?

Saturday, December 10, 2022
 
lawnsea
 
3

In your form id="email" is conflicting with input id="email"

You can use HTML5 attributes for form validation (in HTML5 supported browsers)

http://www.the-art-of-web.com/html/html5-form-validation/#.UnDpBHMW3eU

Code

<?php
if(isset($_POST['submit'])) {
    print_r($_POST);
    die;
    $email_to = "emailaddress";
    $email_subject = "Mint Makeup & Beauty Enquiry";        

    $fname = $_POST['fname']; // required
    $lname = $_POST['lname']; // required
    $message = $_POST['message']; // required
    $email_from = $_POST['email']; // required

    // create email content
    $email_content = "From:"." ".$fname." ".$lname."n"."Email:"." ".$email_from."n"."Message:"." ".$message; 
    mail($email_to, $email_subject, $email_content);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
function validateForm() { 
    var error = false;
    var error_string = 'Please correct the following errors:nn';  
    if (document.getElementById('fname').value == ""){
        error_string += "--> First name must be filled out.n";
        error = true;
    } 
    if (document.getElementById('lname').value == ""){
        error_string += "--> Last name must be filled out.n";
        error = true;
    } 
    if (document.getElementById('email').value == ""){
        error_string += "--> Email must be filled out.n";
        error = true;
    }    
    if(error){
        alert(error_string);
        return false;
    }  else {
        return true;
    }
}
</script>
</head>
<body>
<form onsubmit="return validateForm(this)"  action="" method="post" >

    <div id="form_fname">
    <label for="fname"><img src="images/firstname.png" width="94" height="17" alt="first name" /></label>
    <input type="text" name="fname" id="fname" />  
    </div>   

    <div id="form_lname">
    <label for="lname"><img src="images/lastname.png" width="89" height="17" alt="last name" /></label>
    <input type="text" name="lname" id="lname" />  
    </div>   

    <div id="form_email">
    <label for="email"><img src="images/email.png" width="53" height="17" alt="email" /></label>
    <input type="text" name="email" id="email" />   
    </div>

    <div id="form_message">   
    <label for="Message"><img src="images/message.png" width="77" height="17" alt="message" /></label>
    <textarea name="message" id="message" cols="45" rows="5"></textarea>  
    </div>

    <div id="form_submit"> 
    <input type="submit" name="submit" id="submit" value="Submit" />
    </div>

  </form>
  </body>
  </html>

I just showed you how client side validation works and form is posting correctly.. You should always use server side validation..

Thursday, August 25, 2022
1

I'll leave the original question as is and elaborate here on the various API calls to trigger parameterized builds. These are the calls options that I used.

Additional documentation: https://wiki.jenkins.io/display/JENKINS/Remote+access+API

The job contains 3 parameters named: product, suites, markers

  1. Send the parameters as URL query parameters to /buildWithParameters: http://jenkins:8080/view/Orion_phase_2/job/test_remote_api_triggerring/buildWithParameters?product=ALL&suites=ALL&markers=ALL

  2. Send the parameters as JSON datapayload to /build: http://jenkins:8080/view/Orion_phase_2/job/test_remote_api_triggerring/build

The JSON datapayload is not sent as the call's json_body (which is what confused me), but rater in the data payload as:

json:'{
       "parameter": [
                     {"name":"product", "value":"123"}, 
                     {"name":"suites", "value":"high"}, 
                     {"name":"markers", "value":"Hello"}
                    ]
      }'

And here are the CURL commands for each of the above calls:

curl -X POST -H "Jenkins-Crumb:2e11fc9...0ed4883a14a" http://jenkins:8080/view/Orion_phase_2/job/test_remote_api_triggerring/build --user "raameeil:228366f31...f655eb82058ad12d" --form json='{"parameter": [{"name":"product", "value":"123"}, {"name":"suites", "value":"high"}, {"name":"markers", "value":"Hello"}]}'

curl -X POST 'http://jenkins:8080/view/Orion_phase_2/job/test_remote_api_triggerring/buildWithParameters?product=234&suites=333&markers=555' -H 'authorization: Basic c2hsb21pb...ODRlNjU1ZWI4MjAyOGFkMTJk' -H 'cache-control: no-cache' -H 'jenkins-crumb: 0bed4c7...9031c735a' -H 'postman-token: 0fb2ef51-...-...-...-6430e9263c3b'

What to send to Python's requests In order to send the above calls in Python you will need to pass:

  1. headers = jenkins-crumb
  2. auth = tuple of your (user_name, user_auth_token)
  3. data = dictionary type { 'json' : json string of {"parameter":[....]} }
Wednesday, September 21, 2022
 
knpwrs
 
5

Because very few compilers implement linking of templates. It's hard.

Here's a brief but (I think) informative article about it: http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=53

I say "I think" because it's really not something I'm very familiar with other than that it's widely unimplemented. I initially said the standard didn't require it, but looking at the definition of "export" in C++03, I don't see any indication that it's optional. Maybe it's just a failed standard.

Saturday, November 12, 2022
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :