Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7515589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:51:17+00:00 2026-05-30T00:51:17+00:00

I’m trying to send an email from my application with a PHP contact form,

  • 0

I’m trying to send an email from my application with a PHP contact form, but the details can’t be sent from the application for some reason. Please tell me what is the problem.. I’ve attached the the php form i’m using at the end.

when I try to send an email using the web-browser and writing: http://www.bergerz.co.il/wp-content/themes/ecobiz/sendemailfromapp.php/?name=MYNAME&subject=SUBJECT&email=yositsa@gmail.com&message=MESSAGE, it’s working perfectly.

-(IBAction)send:(id)sender
{
    NSMutableURLRequest * request = [[NSMutableURLRequest alloc] init];

    NSString * urlString = [NSString stringWithFormat:@"http://www.bergerz.co.il/wp-content/themes/ecobiz/sendemailfromapp.php"];

    [request setURL:[NSURL URLWithString:urlString]];
    [request setHTTPMethod:@"REQUEST"];

    NSString * paramDataString = [NSString stringWithFormat:@"name=%@&subject=%@&email=%@&message=%@",[txtName.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],[txtSubject.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],[txtEmail.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],[txtMessage.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

    NSData*paramData = [paramDataString dataUsingEncoding:NSUTF8StringEncoding];
    [request setHTTPBody:paramData];

    NSURLResponse * response;
    NSError * error;

    NSData * aData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];//excute of data to the internet 
    NSString * requestData = [[NSString alloc] initWithData:aData encoding:NSUTF8StringEncoding];
    if ([requestData isEqualToString:[NSString stringWithFormat:@"sent"]])
    {
        lblStatus.hidden = NO;
        lblStatus.text = @"Message Sent..";
    }
    else if ([requestData isEqualToString:[NSString stringWithFormat:@"NO_NAME_ERROR"]])
    {
        lblStatus.hidden = NO;
        lblStatus.text = @"Name is too short";
    }
    else if ([requestData isEqualToString:[NSString stringWithFormat:@"NO_EMAIL_ERROR"]])
    {
        lblStatus.hidden = NO;
        lblStatus.text = @"Email is too short";
    }
    else if ([requestData isEqualToString:[NSString stringWithFormat:@"EMAIL_WRONG_ERROR"]])
    {
        lblStatus.hidden = NO;
        lblStatus.text = @"Email wrong error";
    }
    else if ([requestData isEqualToString:[NSString stringWithFormat:@"NO_MESSAGE_ERROR"]])
    {
        lblStatus.hidden = NO;
        lblStatus.text = @"Message is too short";
    }
    else if ([requestData isEqualToString:@"NULL"])
    {
        lblStatus.hidden = NO;
        lblStatus.text = @"EMPTY";
    }
    NSLog(@"request: %@",request);
    NSLog(@"requestData: %@",requestData);
    NSLog(@"aData: %@",aData);
}

here is the php file: http://www.pastebin.com/BvaiMs04

I’ve edited the message to my latest code, still he isn’t working.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T00:51:20+00:00Added an answer on May 30, 2026 at 12:51 am

    ParamDataString should be name=%@&subject=%@... without the /?.

    AND: You have to escape the input strings: [txtName.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],[txtSubject.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] ...

    or fill everything into a NSDictionary and use urlEncodedString:

    NSDictionary *postParams = [[NSDictionary alloc] initWithObjectsAndKeys: txtName.text, @"foo", txtSubject.text, @"bar", nil];
    //...
    NSString *sPostParams = [postParams urlEncodedString];
    [request setHTTPBody:[NSData dataWithBytes:[sPostParams UTF8String] length:[sPostParams length]]];
    

    Found another bug: HTTP method should be POST, “_REQUEST” does not exist… [request setHTTPMethod:@"POST"];

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.